VB; Sending random ping

Questions about programming languages and debugging
Post Reply
User avatar
ayu
Staff
Staff
Posts: 8047
Joined: 27 Aug 2005, 16:00
15
Contact:

VB; Sending random ping

Post by ayu »

Does anyone have a code that sends out pings to random IP's until you tell it to stop?

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11532
Joined: 06 Apr 2005, 16:00
15
Location: The zone.
Contact:

Post by bad_brain »

umm...I think Maboroshi coded such an app, maybe he provides you with the source... :wink:

User avatar
maboroshi
Dr. Mab
Dr. Mab
Posts: 1602
Joined: 28 Aug 2005, 16:00
15

IP Pinger

Post by maboroshi »

You could try this code

Code: Select all


import random
import popen2
def newip():
    ip = '.'.join([str(random.randint(0, 255)) for x in range(4)])
    return ip

oldip = {}

for i in range(10):
    ip = newip()
    str(ip)
    myopen = "ping " + ip
    outfile, infile = popen2.popen2(myopen)
    results = outfile.read()
    outfile.close()
    print 'results:\n========\n'
    resultlist = results.split(':::')
    for result in resultlist:
        if result.strip():
            print result
            print '---------------\n'
    if not oldip.has_key(ip):
        oldip[ip] = 1

Its written in Python You could easily modify it to make a continious loop

or just edit the value in for i in range

Have Fun

Post Reply