得到快速的arp请求 [英] getting quick arp request

查看:120
本文介绍了得到快速的arp请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


****************

我需要什么:

****************


我需要编写一个扫描仪,测试所有响应的IP地址

a给定端口。

Ip列表的长度大约为200.

我需要每60秒(或更好)获得响应。


我宁愿不先使用nmap。


****************

配置:

*****************

Python 2.4.1。

为了测试发生了什么,我使用ethereal。

我在2GHZ P4和512 Mo上使用winXP pro。


***** ******

问题:

***********


我试过实现一个简单的线程版本,其中每个线程都是

在IP和端口上打开阻塞套接字。


我使用etherereal监控我得到一个arp查询每一秒

粗略。


我期待同一颂歌的速度可以从标准IP /端口扫描仪获得的数量级为b
。为了比较,我使用了

愤怒的Ip扫描仪,我已经看到大约200个arp请求在20秒内发送




*******

另外:

*******


我也考虑过使用一些asynchrone连接,但AFAIK你

需要先打开套接字才能使用arp协议。

谢谢我提前帮你。


Sebastien。


*****************

代码示例:

*****************


#Sebastien 6/9/2006用于测试目的


导入时间

导入队列

来自线程导入*

导入线程

导入插座


试试:

导入psyco

psyco.full()

除外:

传递


类socket_test(线程):

def __init__(self,adresse):

线程.__ init __(self)

self.PORT = 21

self.adresse = str (adresse)

print" in thread adresse =" ;,self.adresse

self.service = []

self.start( )


def run(self):

service_unit = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

service_unit .setblocking(1)

print" socket Ip =" ;,self.adresse


试试:

service_unit.connect ((str(self.adresse),self.PORT))

除了Exception,e:

print" exception",e

self.service.append(service_unit)


class groupe_thread:


def __init __(self,liste):

self.liste = liste


def go(self):

print" self.liste =",self.liste

for el in self.liste:

print" go starting thread on:",el

s = socket_test(el)



liste = []

base =" 192.168.3。"

rang = range(1, 50)
$ r $ b for rng:

add = base + str(r)

liste.append(add)

a = groupe_thread(liste)

ut = a.go()

print" end(main).."

Hello,

****************
What I need :
****************

I need to write a scanner that test all the IP adresses that repond on
a given port.
The Ip list is of roughly of length 200.
I need to get the response every 60 seconds (or better).

I would prefer first not to use nmap.

****************
Configuration :
*****************
Python 2.4.1.
To test what is going on I use ethereal.
I am using winXP pro on a 2GHZ P4 and 512 Mo.

***********
Problem :
***********

I tried to implement a simplistic threaded version where each thread is
opening a blocking socket on the IP and port.

I have monitored using etherereal that I get one arp query every second
roughly.

I am expecting a speed on the same oder of magnitude as the one that
one can get from a standard IP/port scanner. To compare, I have used
angry Ip scanner and I have seen that roughly 200 arp request where
sent in 20 seconds.

*******
Also :
*******

I have also considered using some asynchrone connection but AFAIK you
need first to open the socket and so to use the arp protocol.
Thanks I advance for your help.

Sebastien.

*****************
Code sample :
*****************

# Sebastien 6/9/2006 for testing purposes

import time
import Queue
from threading import *
import threading
import socket

try :
import psyco
psyco.full()
except :
pass

class socket_test (Thread):
def __init__ (self,adresse):
Thread.__init__(self)
self.PORT=21
self.adresse=str(adresse)
print "in thread adresse = ", self.adresse
self.service=[]
self.start()

def run(self) :
service_unit=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
service_unit.setblocking(1)
print "socket Ip = ",self.adresse

try :
service_unit.connect((str(self.adresse), self.PORT))
except Exception,e:
print "exception ",e

self.service.append(service_unit)

class groupe_thread :

def __init__(self,liste):
self.liste=liste

def go(self):
print "self.liste = ",self.liste
for el in self.liste :
print "go starting thread on : ",el
s=socket_test(el)


liste=[]
base ="192.168.3."
rang=range(1,50)
for r in rang:
add=base+str(r)
liste.append(add)
a=groupe_thread(liste)
ut= a.go()
print "the end (main) .."

推荐答案

seb写道:
seb wrote:

我需要编写一个扫描程序,测试所有在给定端口上回馈的IP地址。
I need to write a scanner that test all the IP adresses that repond on
a given port.



....

....


我在2GHZ P4和512 Mo.上使用winXP pro b $ b
I am using winXP pro on a 2GHZ P4 and 512 Mo.



如果你有XP Service Pack 2,它会削弱端口扫描作为

''安全'修复的一部分。从广义上讲,它限制了你可以在操作系统级别建立连接的速度。这将在事件查看器中显示为事件4226,如果它影响到你。


-

Ben Sizer

If you have XP Service Pack 2, it cripples port-scanning as part of a
''security'' fix. Broadly speaking, it limits the rate at which you can
make connections at the OS level; this will show up as event 4226 in
the Event Viewer if it affects you.

--
Ben Sizer


嗨Ben,


我确实在使用XP SP2。

我查了一下在事件查看器上,我还没有看到事件4226.


除此之外我还在同一台PC上运行愤怒的Ip扫描仪2.21。检查使用

ethereal arp请求全部退出(请参阅我的邮件

以上)。


感谢您的建议无论如何。

Sebastien。


Ben Sizer写道:
Hi Ben,

I am indeed using XP SP2.
I have checked on the event viewer and I have not seen the event 4226.

Besides I also run on the same PC angry Ip scanner 2.21. Checking using
ethereal the arp request are all dispatched quit quickly (see my mail
above).

Thanks for the advice anyway.
Sebastien.


Ben Sizer wrote:

seb写道:
seb wrote:

我需要编写一个扫描程序来测试所有在给定端口上回馈的IP地址。
I need to write a scanner that test all the IP adresses that repond on
a given port.



...

...


我在2GHZ P4和512 Mo. $ b上使用winXP pro $ b
I am using winXP pro on a 2GHZ P4 and 512 Mo.



如果你有XP Service Pack 2,它会削弱端口扫描作为

''安全'修复的一部分。从广义上讲,它限制了你可以在操作系统级别建立连接的速度。这将在事件查看器中显示为活动4226事件查看器,如果它影响到您。


-

Ben Sizer


If you have XP Service Pack 2, it cripples port-scanning as part of a
''security'' fix. Broadly speaking, it limits the rate at which you can
make connections at the OS level; this will show up as event 4226 in
the Event Viewer if it affects you.

--
Ben Sizer


嗨Ben,


我确实使用的是XP SP2。


-------------------------

更多信息:

---- ---------------------


1)

我已查看事件查看器当我运行上面的代码示例时,我没有看到事件4226




2)

我仍​​然可以最近看到这个错误(4226)在日志中,所以我必须

已经碰到这个限制试图把它拉出来。


3)

我今天已经安装了进程资源管理器(来自sysinternals)。

我还没有完全习惯它,但是你可以看一下TCP / IP

由进程打开的连接。

看来我打开了alwyas 10个连接(并且IP

在扫描时打开了进度om Ip adresse 192.168.3.1 -254)。


4)

此外我还在同一台PC上运行愤怒的Ip扫描仪2.21。检查使用

ethereal arp请求全部退出(请参阅我的邮件

以上)。


---- --------------------

新结果:

----------- ------------


有些东西限制了我的python程序的TCP / IP连接

最大值10时间。

我的代码中没有看到这个限制。

我没有碰到4226错误。


=这个限制来自哪里。

=我如何克服它。


无论如何,谢谢你的建议。

Sebastien。


Ben Sizer写道:
Hi Ben,

I am indeed using XP SP2.

-------------------------
Some more info :
-------------------------

1)
I have checked on the event viewer and I have not seen the event 4226
while I have run the code sample above.

2)
I can still see this error (4226) recently In the log so that I must
have bumped against this limit trying to put pull this out.

3)
I have installed today process explorer (from sysinternals).
I am not completly used to it but you can have a look at the TCP/IP
connections opened by the processes.
It appears that I have alwyas 10 connections opened (and the IP
adresses progress durning the scan from Ip adresse 192.168.3.1 -254).

4)
Besides I also run on the same PC angry Ip scanner 2.21. Checking using
ethereal the arp request are all dispatched quit quickly (see my mail
above).

------------------------
NEW RESULT :
-----------------------

Something is limiting the TCP/IP connections from my python program at
10 maximum at the same time.
I do not see this limit in my code.
I did not bumped over the 4226 error.

=Where does this limit come from.
=How can I overcome it.

Thanks for the advice anyway.
Sebastien.


Ben Sizer wrote:

seb写道:
seb wrote:

我需要编写一个扫描仪来测试所有的IP地址,这些地址是在给定端口的情况下响应的。
I need to write a scanner that test all the IP adresses that repond on
a given port.



...

...


我在2GHZ P4和512 Mo. $ b上使用winXP pro $ b
I am using winXP pro on a 2GHZ P4 and 512 Mo.



如果你有XP Service Pack 2,它会削弱端口扫描作为

''安全'修复的一部分。从广义上讲,它限制了你可以在操作系统级别建立连接的速度。这将在事件查看器中显示为活动4226事件查看器,如果它影响到您。


-

Ben Sizer


If you have XP Service Pack 2, it cripples port-scanning as part of a
''security'' fix. Broadly speaking, it limits the rate at which you can
make connections at the OS level; this will show up as event 4226 in
the Event Viewer if it affects you.

--
Ben Sizer


这篇关于得到快速的arp请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆