This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NetCat | |
Ex: nc -v IP PORT → Connect to the port | |
Open port and listen: nc -k -l PORT → -k means keep listening | |
Port scanning: nc -zv IP PORTRANGE | |
nc -p 31337 -w 5 host.example.com 42 | |
Open a TCP connection to port 42 of host.example.com, using port 31337 as | |
the source port, with a timeout of 5 seconds: | |
nc -u host.example.com 53 | |
Open a UDP connection to port 53 of host.example.com | |
To listen on port PORT and accept: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kill TCP connection | |
tcpkill -9 host google.com | |
Create IPIP Tunnel: | |
Linux 1: | |
# ip tunnel add ipip-Tunnel mode ipip remote 20.0.0.2 local 20.0.0.1 | |
# ifconfig ipip-Tunnel 10.0.0.1/24 | |
Linux 2: | |
# ip tunnel add ipip-Tunnel mode ipip remote 20.0.0.1 local 20.0.0.2 | |
# ifconfig ipip-Tunnel 10.0.0.2/24 | |
# ip tunnel show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAST | |
Find all hosts on the LAN using ARP: | |
nast -m | |
Find suitable internet gateway: | |
nast -i INTERFACE -g | |
Reset connection: | |
nast -i INTERFACE -r | |
See specific traffic: | |
nast -i INTERFACE -f "src 192.168.1.2" | |
Check who is online poisoning: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find all files in home folder with mp3 format | |
find ~ -iname '*.mp3' | |
Find all directories with 777 perm | |
find /var/www -type d -perm 777 | |
Find all files greater than 20M and sort | |
find / -type f -size +20M -exec ls -lh {} \; 2> /dev/null | awk '{ print | |
$NF ": " $5 }' | sort -nk 2,2 | |
Find text files that were last modified 60 days ago | |
find /home/you -iname "*.txt" -mtime -60 -print |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nethogs - iptraf - bmon - iftop - nmon - glances - iostat - iotop - tload - pstree | |
- httpry- dhcpdump - mysql-sniffer - p0f - pktstat- sysdig- tcptrack - | |
vnstat - goaccess - apachetop - whowatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PostgreSQL | |
Client: psql | |
Connect to server: psql -h server.domain.org database user | |
Connection quit: \q | |
Connect: sudo -u postgres psql postgres | |
Create user: sudo -u postgres createuser -D -A -P myuser | |
Create Database: sudo -u postgres createdb -O myuser mydb | |
Drop Database: drop database DATABASE ; | |
Dump Database: pg_dump -Fc -U USER DATABASE > NAME | |
Restore Database: pg_restore -Fc -j CORE_LIMIT -U USER -d DB OLDDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
According to some problems which happend on servers, it's good idea to use Tmux with RED pane color on servers to avoid problems. | |
After installing Tmux, put this config in "/etc/tmux.conf" or "~/.tmux.conf": set -g status-bg red | |
My terminal demonstration: | |
Green: is my local tmux | |
Red: is server tmux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/IBSng/addons/client/test/run_periodic_credit_changer.py | |
run as client.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jul 4 10:59:36 ibsng-srv RADIUS_WORKER_1: ibs_start_stop:Accounting-Request packet from host 172.16.8.11 port 55815, id=79, length=217 | |
NAS-IP-Address = 172.16.8.11 ---> ras ip between aaa& ras | |
Acct-Session-Time = 0 | |
Acct-Input-Packets = 0 | |
NAS-Identifier = MikroTik | |
Acct-Terminate-Cause = User-Request | |
Acct-Session-Id = 81900079 | |
Acct-Input-Octets = 0 | |
NAS-Port-Type = Virtual | |
Acct-Status-Type = Stop --->status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("../../inc/init.php"); | |
require_once(IBSINC."bw_face.php"); | |
require_once(IBSINC."bw.php"); | |
require_once(IBSINC."report_lib.php"); | |
needAuthType(ADMIN_AUTH_TYPE); | |
$smarty=new IBSSmarty(); | |
intActiveLeavesInterface($smarty); | |
print_r($_REQUEST); |