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 / escalation.py
Created February 5, 2020 21:52
Building a Windows-based service and admin-type user creation for OS privilege escalation
#/usr/bin/python
import servicemanager
import win32serviceutil
import win32service
import win32api
# define the action to do when we get signals
class Service(win32serviceutil.ServiceFramework):
@davidlares
davidlares / oc.c
Last active February 13, 2020 03:09
Bit-wise One's Complement (0's - 1's) operation examples in C
#include <stdio.h>
void showbits(int number) {
// logic for One's complement
int i, k, andmask;
// 16 bit representation
for(i = 15; i >= 0; i--) {
andmask = 1 << i;
k = andmask & number;
// ternary evaluation
@davidlares
davidlares / rs.c
Created February 14, 2020 18:22
Bit-wise Right Shift (>>) operator example in C
#include <stdio.h>
#include <stdlib.h>
// getting the binary representation - 16 bit format
void showbits(int number) {
int i, k, andmask;
for(i = 15; i >= 0; i--) {
andmask = 1 << i;
k = andmask & number;
@davidlares
davidlares / ls.c
Created February 14, 2020 21:09
Bit-wise Left Shift (<<) operator example in C
#include <stdio.h>
#include <stdlib.h>
// getting the binary representation - 16 bit format
void showbits(int number) {
int i, k, andmask;
for(i = 15; i >= 0; i--) {
andmask = 1 << i;
k = andmask & number;
k == 0? printf("0") : printf("1");
@davidlares
davidlares / and.c
Created February 15, 2020 18:31
Bit-wise AND (&) operator example in C
#include <stdio.h>
#include <stdlib.h>
int main() {
// starting value
int data = 65;
// using the AND operator
int result = data & 32; // internally performs a binary comparison for the 5th bit (log 32 is 5)
// data evaluation
if(result == 0) {
@davidlares
davidlares / xor.c
Created February 16, 2020 18:57
Bit-wise XOR (^) operator example in C
#include <stdio.h>
#include <stdlib.h>
int main() {
int b = 50;
b = b ^ 12;
printf("XOR Output is %d \n", b);
b = b ^ 12;
printf("XOR Output is %d \n", b);
return 0;
@davidlares
davidlares / vuln.py
Created February 18, 2020 22:22
A Py3 vulnerability scanner
#!/usr/bin/python3
import socket
import os
import sys # handling CLI args
def get_banner(ip, port):
try:
socket.setdefaulttimeout(2)
s = socket.socket()
@davidlares
davidlares / banner-grabbing.py
Last active February 19, 2020 17:19
Banner-grabbing known-ports script
#!/usr/bin/python3
import socket
def get_banner(ip, port):
try:
socket.setdefaulttimeout(2)
s = socket.socket()
# connection evaluation
s.connect((host, port))
@davidlares
davidlares / hash.py
Created February 20, 2020 19:02
String hash-type methods with Py3
#!/usr/bin/python3
# performing hashing
import hashlib
hashvalue = input("[+] Enter a string to hash: ")
# hashing md5
hashobj = hashlib.md5()
hashobj.update(hashvalue.encode())
print(hashobj.hexdigest()) # printing data
@davidlares
davidlares / sha1.py
Created February 20, 2020 19:35
Brute-forcing SHA1 passwords w/ Py3
#!/usr/bin/python3
from urllib.request import urlopen
from termcolor import colored
import hashlib
# input - sha1 hash
hash = input("[+] Enter sha1 hash value: ")
# converting the request into a string
plist = str(urlopen("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt").read(), 'utf-8')