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 / brute_auth.py
Created March 10, 2020 19:41
Basic and Digest Auth Bruteforcer Script (non-optimized) w/ Python
#!/usr/bin/python
import requests
from threading import Thread
import sys
import time
import getopt
from requests.auth import HTTPDigestAuth
global hit
@davidlares
davidlares / bypass.py
Created March 13, 2020 16:23
Forwarding traffic through SOCKS server (HTTP protocol Proxy)
#!/usr/bin/python
import socks
import socket
from urllib.request import urlopen
if __name__ == "__main__":
# defining the SOCKS proxy and the host
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "localhost", 9050)
# performing an request
@davidlares
davidlares / ssl_shell.py
Created March 13, 2020 19:24
A simple Reverse shell script with SSL encryption (Wrapping sockets)
#!/usr/bin/python
'''
The counterpart is done by: ncat --ssl -vlp 8888
'''
import os
import socket
import ssl # for socket wrapper
@davidlares
davidlares / david.service
Created March 20, 2020 00:30
A basic Linux SystemD-based manifest file for describing OS services
[Unit]
Description=Daemon for creating a txt file in a specified user
After=network.target
[Service]
User=root
ExecStart=/home/david/service_folder/file_creation.sh
[Install]
Wantedby=multi-user.target
@davidlares
davidlares / infobox.sh
Last active March 21, 2020 01:20
Displaying Interactive Bash scripts menus with the dialog command
#!/bin/bash
# dialog box -> ability to created text-based menus, inputs, textbox -> more graphical
# apt install dialog
# global / default values
INFOBOX=${INFOBOX=dialog}
TITLE="Default title"
MESSAGE="Something to say"
XCOORD=10
@davidlares
davidlares / shortcuts.sh
Created March 21, 2020 01:33
Performing Shell expansions operations in simple isolated examples
#!/bin/bash
# shell expansion -> ability to use shortcuts to manage ouputs
echo sh{ot,ort,oot} # print out a list
echo st{il, al}l
# getting the HOME directory
echo ~
@davidlares
davidlares / signals.sh
Created March 21, 2020 01:37
Handling bash Signals events for program interruptions or a simple kill
#!/bin/bash
# traps (look for the ocurrence of something - event, commands, signals -> redirect reaction) and signals
clear
# what to do, what is it we are traping
trap 'echo " - Please Press Q to Exit ..."' SIGINT SIGTERM SIGTSTP # interrupt or simple kill
while [ "$CHOICE" != "Q" ] && [ "$CHOICE" != "q" ]; do
@davidlares
davidlares / substitution.sh
Last active March 21, 2020 03:25
A simple command substitution example with bash scripting
#!/bin/bash
# doing some simple substitution using ``
TODAYSDATE=`date`
USERFILES=`find . -user david`
echo "Today's Date: $TODAYSDATE"
echo "All files by USER: $USERFILES"
@davidlares
davidlares / file_descriptors.sh
Created March 21, 2020 02:30
Working with bash file-descriptors for file-logging operation purposes.
#!/bin/bash
# file descriptors - is a numeric representation of a file to read-write to it - determine how to open it at runtime
# the number should be >= 3 because 0,1 and 2 are reserved by the OS to stdout, stdin and stderr respectively
echo "Enter a file"
read FILE # file variable
echo "The file is: $FILE"
# referring to the stream in (read&write mode = <>)
exec 5<>$FILE
@davidlares
davidlares / exit.sh
Created March 21, 2020 03:24
Intercepting the EXIT command with bash for custom functions w/ trap command
#!/bin/bash
# handling EXIT command
trap 'exitProc' EXIT
exitProc() {
echo "Exit instruction intercepted"
echo "Cleaning files"
rm -rf first.txt second.txt
exit 1000