我在Python中做了一個簡單的TCP fuzzer。我需要它能夠得到一些迴應,如果我沒有得到答覆,打破循環。我的代碼是這樣的:python中的Socket.receive
import socket
from time import sleep
import sys
ip = raw_input ("please insert host ip: ")
port = input ("please insert port to fuzz: ")
packet = raw_input ("what string would you like to fuzz with? : ")
multi = input ("in what jumps would you liike to multiply the string ? (10 = A*10) : ")
host = ip, port
s = socket.socket()
char = packet * multi
a = 1
try:
while a > 0:
s.connect((host))
s.send(packet)
sleep(1)
print 'fuzzing param %s' % (packet)
packet = char + packet
s.close()
except (Exception):
print "Connection lost for some reason"'
但是當我運行程序我得到這個錯誤:
please insert host ip: 10.0.0.138
please insert port to fuzz: 80
what string would you like to fuzz with? : A
in what jumps would you liike to multiply the string ? (10 = A*10) : 2
fuzzing param A
Connection lost
這是奇怪的,因爲它只是想在一個無限循環重新連接,(我知道服務器沒't crush)
I會強烈建議你嘗試Peach:http://peachfuzzer.com/ – zenpoy 2012-07-15 10:34:58
我不會真的在專業上使用它我有更好的fuzzer,但它更適合我的python編程練習 – Ba7a7chy 2012-07-15 10:40:56
我認爲你應該每次連接主機:在'While'循環中移動's.connect(host)',因爲服務器可能會在你發送它的時候關閉連接。 – zenpoy 2012-07-15 10:44:14