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 Blush Mousedeer, 8 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
import sys

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

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

    # sockets
    reciever = None
    sender = None

    # finished?
    finished = False

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

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

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

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

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

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

if __name__ == "__main__":
    # lets get the address from the commandline args
    if len(sys.argv) <= 1:
        # nothing been specified
        print "You need to give an address"
        print "%s <server>" % sys.argv[0]
        sys.exit() # we can't do anything.
    
    tracert = TraceRoute(sys.argv[1])
    while not tracert.finished:
        tracert.next_server()
U2FsdGVkX1+FVHMwVbBlcGm2RFgXaZKWabZI5Qi5lJbJqp2A7R4zgYpErpwwWKuRTadpdFJOy5xg+pIMxuu3naocJlLwRnjJ73Ms
BR1eOs/vdIcNEZyIvX7y8xjiZKIwtAnvJ9HKQaA2dVpDCJdY8gzy3Jb6jToloo+LnBxh2Jd/rrv13qRRQlcOda0pan+2onrrLqFf
E7dz9vN+OJaBwvtQwhgNTxLrr3x6lGZVuWBF9meon7Svym0Yc8QoNxDeozdBMUWjbndS9hycZfyQOPDNNg1nilBHTpyUbpFldSTX
RWlHHV+StroZUjSgYzi2j2d3vR5VIaYs3yZUcsEz44RKBTYiGfqG7k8ru20qb7TDTwF0Uy0dhWjM1VBDe6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