Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###### Created by _jun ######
- # -*- coding : utf-8 -*-
- #Imports
- import logging #Servant a desactiver le message d'erreur IPv6 de Scapy
- logging.getLogger("scapy.runtime").setLevel(logging.ERROR) #Pareil
- import time
- import os
- from scapy.all import * #Scapy import (To send packets)
- from pyfiglet import Figlet #Thank's to coyotus
- from subprocess import Popen, call, PIPE #Import which make me able to launch shell code
- #Fin des imports
- #color
- global red
- red = '\033[31m'
- global green
- green = '\033[32m'
- global reset
- reset = '\033[0m'
- global yellow
- yellow = '\033[33m'
- global cyan
- cyan = '\033[36m'
- global magenta
- magenta = '\033[35m'
- global cls
- cls = '\33c'
- #end color
- #Fonctions
- def send(rhost):
- """Sends a packet to test if telnet port is open"""
- print(yellow+"Pinging "+rhost+". . .") #Pinging the rhost before sending a SYN packet.
- try: #
- rep, non_rep = sr(IP(dst=rhost) / ICMP(), verbose=False, timeout=3) #Trying to ping the remote host
- except: #
- print(red+"Please enter a correct RHOST. The host is unreachable."+reset) #RHOST down or not nicely typed.
- for elem in rep:
- if elem[1].type == 0: #If rep have an element, so the host is up, and if the host is up, we can send a packet.
- print(reset+elem[1].src+" is "+green+"up"+reset+".")
- isUp = True
- if(isUp == True):
- print(yellow+"Sending packet to "+rhost+". . . I can take a while. . . ")
- packet = IP(dst=rhost)/TCP(sport=80, dport=23, flags='S')
- rep, non_rep = sr(packet, verbose=0)
- for emis,recu in rep:
- if recu[1].flags == 18:
- print(reset+rhost+" telnet's port is "+green+"open"+reset+".")
- choice = raw_input(green+"Would you like to connect to it ? [Y/n]\n> ")
- if(choice == "Y" or choice == "y"):
- print(red+"Connecting. . .")
- os.system('telnet '+rhost)
- else:
- print(cyan+"Goodbye, Sir !"+reset)
- time.sleep(2)
- print(cls)
- else:
- print(red+"The RHOST is down, or he's blocking ICMP requests. (Pings)\nYou can always try a manual telnet connexion and hope it'll work."+reset)
- #Begin
- print(cls)
- msg = Figlet(font='slant') #WELCOME EVYBUDY
- print(msg.renderText('Telnet Pwner'))
- rhost = raw_input("Please enter the IP address :\n> ")
- send(rhost) #Call the send() fonction with rhost argument
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement