A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Re: Traceroute in python - Stikked
From tera.lav007@gmail.com, 5 Years ago, written in Python.
This paste is a reply to Traceroute in python from Jessica - go back
Embed
Viewing differences between Traceroute in python and Re: Traceroute in python
import socket
socket
import sys

sys

class TraceRoute(object):
    
TraceRoute(object):
    
    BADDR = "0.0.0.0" # default bind address - (all IPs)
    
IPs)
    
PORT = 33434 # default port
port
    ICMP = socket.getprotobyname('icmp')
getprotobyname('icmp')
    UDP = socket.getprotobyname('udp')

    
getprotobyname('udp')

    
desternation = ""
""
    ttl = 0 # we inrecement this by one each time.    \n\n        

    
sockets
    
sockets
    
reciever = None
    
None
    
sender = None

    
None

    
finished?
    
finished?
    
finished = False

    
False

    
def __init__(self, desternation):
desternation):
        self.desternation = socket.gethostbyname(desternation)
        
gethostbyname(desternation)
        
        self.reciever = socket.socket(socket.AF_INET, socket.SOCK_RAW, self.ICMP)
ICMP)
        self.sender = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, self.UDP)
        
        
UDP)
        
        
# bind to reciever so we can listen for replies
replies
        self.reciever.bind((self.BADDR, self.PORT))

    
PORT))

    
def next_server(self):
next_server(self):
        """ Connects to next server 1 hop away from current server (i.e. server[ttl + 1]) """
"""
        if self.finished:
            
finished:
            
# we have nothing to do, just return
            return

        
return
            return

        
# first job increment the ttl on the socket
socket
        self.ttl += 1
1
        self.sender.setsockopt(socket.SOL_IP, socket.IP_TTL, self.ttl)
        
ttl)
        
        self.sender.sendto("", (self.desternation, self.PORT))
PORT))
        current_server = self.reciever.recvfrom(512)[1][0] # get 512 bytes from the reciever 
reciever 
        self.display(current_server)

display(current_server)

        if current_server == self.desternation:
desternation:
            self.finished = True

    
True

    
def display(self, address):
        
address):
        
""" Gets the hostname (if we can) and displays """
        try:
"""
        try:
            name = socket.gethostbyaddr(address)[0]
gethostbyaddr(address)[0]
            print "%s) %s (%s)" % (self.ttl, name, address)
address)
        except socket.error:
            
error:
            
# we couldn't - we'll just tell them the IP address
address
            print "%s) %s" % (self.ttl, address)
        
    
address)
        
    
def __del__(self):
        
__del__(self):
        
""" Be good and close our sockets """
        try:
"""
        try:
            self.reciever.close()
close()
        except socket.error:
            
error:
            
# already closed
            pass

        try:
closed
            pass

        try:
            self.sender.close()
close()
        except socket.error:
            
error:
            
# already closed
            pass

closed
            pass

if __name__ == "__main__":
    
"__main__":
    
# lets get the address from the commandline args
args
    if len(sys.argv) <= 1:
        
1:
        
# nothing been specified
        
specified
        
print "You need to give an address"
address"
        print "%s <server>" % sys.argv[0]
argv[0]
        sys.exit() # we can't do anything.
    
anything.
    
    tracert = TraceRoute(sys.argv[1])
argv[1])
    while not tracert.finished:
finished:
        tracert.next_server()