Skip to content

Instantly share code, notes, and snippets.

View mstfydmr's full-sized avatar
🚀
Focusing

Mustafa Aydemir mstfydmr

🚀
Focusing
View GitHub Profile
@mstfydmr
mstfydmr / migrate-django.md
Last active October 24, 2018 06:07 — forked from sirodoht/migrate-django.md
How to migrate Django from SQLite to MySQL

How to migrate Django from SQLite to MySQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on MySQL. Then:

@mstfydmr
mstfydmr / tcp_flags.txt
Created July 12, 2018 13:37 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@mstfydmr
mstfydmr / parse_uptime_output.py
Last active July 21, 2018 08:19
Python3 - Linux uptime command output parser
# Parse Uptime
# ------------------------------
def parse_uptime(output = False):
try:
import re
parsed = []
# Install requirements
apt-get install -y build-essential
apt-get install -y checkinstall
apt-get install -y libreadline-gplv2-dev
apt-get install -y libncursesw5-dev
apt-get install -y libssl-dev
apt-get install -y libsqlite3-dev
apt-get install -y tk-dev
apt-get install -y libgdbm-dev
apt-get install -y libc6-dev
@mstfydmr
mstfydmr / bytes.py
Created August 10, 2018 09:26 — forked from leepro/bytes.py
Human readable bytes conversions
## {{{ http://code.activestate.com/recipes/578019/ (r15)
#!/usr/bin/env python
"""
Bytes-to-human / human-to-bytes converter.
Based on: http://goo.gl/kTQMs
Working with Python 2.x and 3.x.
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
@mstfydmr
mstfydmr / sqlmap.md
Last active March 10, 2019 10:20
Sqlmap

Windows

C:\Python27\python.exe sqlmap.py -v 3 --risk=3 --level=3 --identify-waf --random-agent --tamper=space2comment -u URL

Linux

./sqlmap.py -v 3 --risk=3 --level=3 --identify-waf --random-agent --tamper=space2comment -u URL

Usage

sqlmap.py -u URL --dbs
sqlmap.py -u URL -D DATABASE --tables
@mstfydmr
mstfydmr / generate_ssh_key.sh
Created May 1, 2019 12:01
Generate SSH Key
ssh-keygen -t rsa
# === OR ====
mkdir /path/to/folder
chmod -R 755 /path/to/folder
ssh-keygen -t rsa -b 4096 -C "[email protected]" -f /path/to/folder/key -q -N “”
@mstfydmr
mstfydmr / pip_upgrade_all.sh
Created May 7, 2019 08:18
PIP - Upgrade All
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@mstfydmr
mstfydmr / mysql_cli.sql
Last active August 29, 2019 18:29
MySQL CLI
CREATE DATABASE dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
# Dump
mysqldump -uUSER -pPASS DBNAME > dump.sql
# Restore
@mstfydmr
mstfydmr / clean.sh
Created September 17, 2021 06:59 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs