Skip to content

Instantly share code, notes, and snippets.

@perbu
perbu / nacl.txt
Created December 19, 2017 08:47
Example NaCl config for a simple firewall.
Iface outside {
address: 10.0.0.2,
netmask: 255.255.255.0,
gateway: 10.0.0.1,
index: 0
}
Iface inside {
address: 192.168.0.1,
netmask: 255.255.255.0,
Iface eth0 dhcp
eth0.index: 0
Iface k1 {
address: 10.0.1.1,
netmask: 255.255.255.0,
index: 2,
prerouting: [ fw, mydnat ]
}
@perbu
perbu / captcha.md
Created September 24, 2017 07:05 — forked from Samuirai/captcha.md
G-WAN Captcha Decode

G-WAN is a new free web server. They seem to be very proud of it, or at least just want to make a lot of money. Well anyway, in almost every sentence they write, they claim that they are 20% cooler than anything else. It feels a bit arrogant. I have to admit, I don't know a lot about web servers, so I can't speak to how good they are.

However, then I saw their Captcha example. I also don't know much about machine learning algorithms, OCR, and stuff like that, but I do know how to read pixels. I also know how to compare values with python :P

demo

They say the following about their Captcha:

#!/usr/bin/perl
use IO::Socket;
use constant MAXWRITE => 2000; #biggest write we'll attempt
use strict;
use warnings;
$|++; # autoflush stdout
my ($host,$port) = @ARGV;
o oooooo o
oo oooooooooo oo
oo oooooooooCoooooooooo oo
o oooooooooooooooooooooooo o
o oooooooooooooooooooooooCoooooooooo o
oooooooooooooooooooooooooooooooooooooo
oooooooooooooooCoooooooooooooooooooooooooooooooo
o oooooooooooooCoooooooooooooooooooooooooooooooooooooo o
oo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oo
o oooooooooooooooooooooooCoooooooooooooooooooooooooooooooooooooooooo o
MMMMMMMMMMMMMMMNdhs++shdNMMMMMMMMMMMMMMM
MMMMMMMMMMMNNhyo++++++++oyhNNMMMMMMMMMMM
MMMMMMMMNmyso++++++++++++++osymNMMMMMMMM
MMMMNmhyo++++++++++++++++++++++oyhmNMMMM
NNdho++++++++++++++oo++++++++++++++ohdNN
hyoo++++++++++++osssssso++++++++++++ooyh
yyhhyso++++++oos+:. .:+soo++++++osyhddd
yyyyyyhysoos+:`` ``:+sooyhddddddd
yyyyyyyyyNd+:` `-/smddddddddd
yyyyyyyyyNdddho+. .//++/:mddddddddd
**** PANIC: ****
Stack protector: Canary modified
**** CONTEXT: ****
Connection::on_data: data from 10.0.0.42:80 10.0.0.1:59532 (ESTABLISHED)
GET /api/dashboard HTTP/1.1
Host: 10.0.0.42
Connection: keep-alive
Accept: application/json, text/plain, */*
[ 25%] Building CXX object CMakeFiles/diskbuilder.dir/main.cpp.o
In file included from /Users/perbu/git/IncludeOS/diskimagebuild/main.cpp:10:
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:22:15: warning: default template arguments for a function template are a C++11 extension [-Wc++11-extensions]
template <int Mult = SECT_SIZE>
^ ~~~~~~~~~
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:54:10: error: no member named 'emplace_back' in 'std::__1::vector<Dir, std::__1::allocator<Dir> >'
subs.emplace_back(path);
~~~~ ^
/Users/perbu/git/IncludeOS/diskimagebuild/filetree.hpp:59:11: error: no member named 'emplace_back' in 'std::__1::vector<File, std::__1::allocator<File> >'
files.emplace_back(path);
[874377.384908] ata7.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
[874377.392102] ata7.00: failed command: FLUSH CACHE EXT
[874377.397198] ata7.00: cmd ea/00:00:00:00:00/00:00:00:00:00/a0 tag 0
[874377.397198] res 40/00:01:00:4f:c2/00:00:00:00:00/00 Emask 0x4 (timeout)
[874377.410958] ata7.00: status: { DRDY }
[874377.414753] ata7: hard resetting link
[874387.767905] ata7: softreset failed (1st FIS failed)
[874387.772922] ata7: hard resetting link
[874398.128877] ata7: softreset failed (1st FIS failed)
[874398.133885] ata7: hard resetting link
#!/usr/bin/perl
use strict;
use warnings;
use Digest::MD5 qw(md5);
use base qw(Net::Server::HTTP);