Skip to content

Instantly share code, notes, and snippets.

View farooqkz's full-sized avatar

Farooq Karimi Zadeh farooqkz

View GitHub Profile
import cherrypy
class Hello:
@cherrypy.expose
def index(self, key=""):
if key == "":
return "Hello. Please enter key. [Some form here with textbox and submit button and perhaps some fancy features...]"
elif key == "THE SECRET KEY":
return "Hello you have entered the right key!"
else:
@farooqkz
farooqkz / get_pubip_from_router.py
Created December 29, 2017 10:13
A small script to get my public IP from my router/modem
import telnetlib
PASSWORD = "admin" # change these two
ADDR = "192.168.1.1"
t = telnetlib.Telnet(host=ADDR)
t.read_until("Password:".encode())
t.write((PASSWORD + "\r\n").encode())
t.read_until("TP-LINK> ".encode())
t.write("show wan status\r\n".encode())
@farooqkz
farooqkz / m234.py
Created December 27, 2017 15:01
-
#!/usr/bin/python3.5
# Hi, I am a program who select a random element from S n times.
# you should specify n via m234.py n
# My father is Farooq KZ
# You can contact him at farooghkarimizadeh@gmail.com
# Also I'm under MIT/X11 licence
import os # I want it for os.urandom
import sys # I want it for sys.argv and sys.exit
@farooqkz
farooqkz / look.pl
Last active December 13, 2017 15:52
More advanced look utility
#!/usr/bin/perl -Tw
##############################################################################
#
# Copyright (C) 2017 Farooq Karimi Zadeh <farooghkarimizadeh@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@farooqkz
farooqkz / vigenere.c
Last active December 13, 2017 15:55
Something like Vigenere cipher but for bytes instead of letters
/*
Vigenere File Coder and Decoder
Copyright (C) 2017 Farooq Karimi Zadeh <farooghkarimizadeh@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
@farooqkz
farooqkz / hexview.c
Last active December 13, 2017 15:55
Simple file viewer in hex format. usage: hexview <filename>
// hexview.c
// Author: FarooqKZ
// It's free software under GPL3+ and comes WITHOUT ANY WARRENTY FROM MAIN AUTHOR
#include <stdio.h>
int main(int argc, char *argv[]){
if (argc == 1 || !strcmp(argv[1], "-h")){
printf("Usage: hexview file_path\n");
return 0;
}
@farooqkz
farooqkz / hexview.py
Last active December 13, 2017 15:55
simple file viewer in hex format. usage: hexview.py <filename>
#!/usr/bin/python3
'''
HexView.Py - A simple File Viewer in Hexadecimal format.
Author: FarooqKZ
Under GPL3+. THIS SOFTWARE COMES WITH NO WARRENTY FROM MAIN AUTHOR.
'''
import sys # I inlcude this to use sys.exit() and sys.argv