Skip to content

Instantly share code, notes, and snippets.

View the-c0d3r's full-sized avatar

the-c0d3r

View GitHub Profile
@the-c0d3r
the-c0d3r / supervisor_timestamp.patch
Created October 13, 2018 11:47
A quick patch for supervisor to add in timestamp for the standard output and standard error log file of the processes.
diff --git a/supervisor/dispatchers.py b/supervisor/dispatchers.py
index 5a96199..dc8087a 100644
--- a/supervisor/dispatchers.py
+++ b/supervisor/dispatchers.py
@@ -134,7 +134,7 @@ class POutputDispatcher(PDispatcher):
maxbytes = getattr(config, '%s_logfile_maxbytes' % channel)
backups = getattr(config, '%s_logfile_backups' % channel)
- fmt = '%(message)s'
+ fmt = '%(asctime)s: %(message)s'
@the-c0d3r
the-c0d3r / cat_overwrite
Created September 8, 2018 02:29
use 'less' or 'cat' based on number of lines and how big is the terminal
function cat() {
if [ -f $1 ]; then
terminal_height=$(tput lines)
file_lines=$(wc -l < $1 | awk '{print $1}')
if (( $file_lines > $terminal_height )); then
less $1
else
/bin/cat $1
fi
@the-c0d3r
the-c0d3r / POSTer.py
Created June 24, 2016 03:32
A small tool to send POST request with data, and shows the response.
import requests
def post(url=None, payload=None):
if not url:
url = getinput("Enter POST url : ")
if not payload:
payload = getinput("Enter POST data : ")
r = requests.post(url, data=payload)
@the-c0d3r
the-c0d3r / marquee.py
Created June 24, 2016 03:12
A marquee effect of HTML with python inside terminal
import sys
import time
def main():
program = animate()
program.data = input("Enter string : ") + " "
program.width = int(input("Enter width : "))
program.animate()
@the-c0d3r
the-c0d3r / rmdup.py
Created December 11, 2015 11:12
Remove Duplicates from Wordlist
#!/usr/bin/env python
import timeit
import os
"""
When : 18/11/2015
Where : Home
What : A program to remove duplicate words inside a wordlist
Why : Because it seems like a good idea at that time,
to know, understand or even create a better algorithm for it.
@the-c0d3r
the-c0d3r / password_animation.py
Last active December 30, 2015 04:31 — forked from StevenMaude/password_animation.py
Movie-like password cracking animation in Python that looks nifty. Code for guessing a string written for a problem in "Problem Solving with Algorithms and Data Structures" with my additional idea of printing every attempt and slowing down prints to make them readable.
import random
import time
import sys
import string
def generate_random_guess(chars):
return random.choice(chars)
def repeated_guesses(target):
@the-c0d3r
the-c0d3r / powerline-install.sh
Created November 29, 2015 11:35
Powerline Shell installation bash script
# Powerline shell install
# Source : http://askubuntu.com/a/283909
sudo apt-get install python-pip git -y
sudo pip install git+git://github.com/Lokaltog/powerline
# Font installation
wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
sudo mv PowerlineSymbols.otf /usr/share/fonts/
import urllib
import Queue
import threading
import time
import sys
global vulnSite
vulnSite = []
#!/usr/bin/env python
import socket, os, sys, getopt
from struct import *
print "\033[95m /\\ /\\/ __\\"
print " / /_/ / / Honeypy - A HoneyPot for port scans"
print "/ __ / /___ Made for http://HackCommunity.com by H3R0"
print "\\/ /_/\\____/ \033[0m"
print "Usage: ./honeypy -p 1337\n"
@the-c0d3r
the-c0d3r / algorithm.py
Created August 16, 2015 08:21
This is a simple way to demonstrate how the python file can rewrite it's own source code. This is particularly useful for checking if the program is first run or not. Something like that.
import sys
con = '#'
if __name__ == '__main__':
fname = sys.argv[0]
content = open(fname).read()
newfile = open(fname,'w')