Skip to content

Instantly share code, notes, and snippets.

View parsibox's full-sized avatar

Mohsen Davari parsibox

View GitHub Profile
sudo -i
sudo yum -y update
sudo yum -y install epel-release
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y fio ioping nload psmisc wget htop nano iftop telnet net-tools mlocate mtr yum-utils sysstat zip unzip traceroute tcptraceroute tcpdump bind-utils ftp.x86_64 policycoreutils-python
sudo sed -i -e 's/10/2/g' /etc/cron.d/sysstat
sudo echo "DefaultLimitNOFILE=1024000" >> /etc/systemd/system.conf
sudo echo "DefaultLimitNOFILE=1024000" >> /etc/systemd/user.conf
@parsibox
parsibox / ussd_bind.php
Created October 6, 2017 14:39
connect with uap protocol to USSDC
<?
function printHex($pdu){
$ar=unpack("C*",$pdu);
foreach($ar as $v){
$s=dechex($v);
if(strlen($s)<2)$s="0$s";
print "$s ";
}
print "\n";
@parsibox
parsibox / check_for_hack_directadmin_shell
Last active January 5, 2024 13:57
check for shell script in directadmin vps ( hack , find , directadmin )
grep -lr --include=*.php "eval(base64_decode" /home
find /home -type f -name '*.php' | xargs grep -l "eval *(" --color
find /home -type f -name '*.php' | xargs grep -l "base64_decode *(" --color
find /home -type f -name '*.php' | xargs grep -l "gzinflate *(" --color
find /home -type f -name '*.php' | xargs grep -l "outdo" --color
find /home -type f -name '*.php' | xargs grep -l "eval*_POST" --color
find /home -type f -name '*.php' | xargs grep -l "$ptzrw" --color
find /home/*/domains/*/public_html/wp-content/uploads -type f -name '*.php'
find /home/ -type d -perm 777 -exec find {} -name "*.php" \;
@parsibox
parsibox / mariadb_config
Created December 19, 2017 07:33
change mariadb utf8mb4 and max allowed packet
nano /etc/my.cnf.d/server.cnf
[mysqld]
sql_mode=""
max_allowed_packet=512M
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
max_connections = 10000
awk -F\" '($2 ~ "4up16eyjtx.php"){print $1 $2 $3 $4}' /var/log/httpd/domains/*log
@parsibox
parsibox / mikrotik_ssh_to_array
Created December 22, 2017 20:14
conver mikrotik ssh to array
function mikrotik_ssh_to_array( $x ){
$out_arr=array();
$out_i=0;
$x=str_replace('"' , '' , $x);
preg_match_all('/([^:]*?):([^\r\n]*)\r\n?/', $x, $matches);
foreach( $matches[1] as $k ){
$k=preg_replace('/\r\n/','' , $k);
$k = preg_replace('!\s+!', ' ', $k);
$k_arr=explode(' ', $k);
@parsibox
parsibox / empty_directadmin_cronjob.sh
Created December 24, 2017 07:08
make empty all directadmin user cron job
for k in `find /usr/local/directadmin/data/users/ -type f -name 'crontab.conf' `; do echo"" > $k;done
@parsibox
parsibox / find_string_in_all_directadmin_http_log.sh
Created December 24, 2017 08:03
find string in all directadmin http log
awk -F\" '($2 ~ "evtbxznx"){print $0$1$2}' /var/log/httpd/domains/*log
@parsibox
parsibox / backup_mysql_table.sh
Created December 24, 2017 19:25
shell script for backup only one table from mysql
#!/bin/bash
DATE=`date +%Y-%m-%d-%H-%M-%S`
LOCAL_BACKUP_DIR="/var/www/backup"
DB_NAME="xxxxxxxx"
DB_USER="xxxxxxxxx"
DB_PASSWORD="xxxx"
table=$1
############### Local Backup ########################
npm install
npm test