Skip to content

Instantly share code, notes, and snippets.

View rodrigomanara's full-sized avatar
🎯
Focusing

codediesel rodrigomanara

🎯
Focusing
View GitHub Profile
@rodrigomanara
rodrigomanara / update-mysql.md
Created May 20, 2021 08:32 — forked from cosmomathieu/update-mysql.md
Upgrade MySQL 5.5 to 5.7 Ubuntu 16

Upgrade MySQL 5.5 to 5.7 Ubuntu 16

First of all , Backup All your Database.

mysqldump --all-databases > all_databases.sql

Grab the library which contains the 5.7 verson

wget https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.deb
@rodrigomanara
rodrigomanara / make_user_gen_ssh.sh
Created April 28, 2021 12:53 — forked from robmsmt/make_user_gen_ssh.sh
make_user_gen_ssh.sh
#!/bin/bash
NEW_USER=$1
set -e
if [ -z "$NEW_USER" ];then
echo "Please provide user as arg... exiting."
exit 1
fi
@rodrigomanara
rodrigomanara / recaptcha.php
Last active September 21, 2020 08:52
recaptcha v3 php
<?php
// Checking reCAPTCHA
$recaptcha_site_secret = "xxxxx";
if(isset($_POST) && !empty($_POST))
{
$captcha_response = filter_input(INPUT_POST, 'g-recaptcha-response',
@rodrigomanara
rodrigomanara / randon_string.php
Created August 3, 2020 08:04
function to generate random string
<?php
function RandomString()
{
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$randstring = '';
for ($i = 0; $i < 10; $i++) {
$randstring = $characters[rand(0, strlen($characters))];
}
@rodrigomanara
rodrigomanara / create_list_of_files.php
Last active June 1, 2020 15:18
how to add all files from a folder into one file and add as require_once???
#!/usr/bin/env php
<?php
/**
*
* @param type $custom
* @return type
*/
function build_list($custom)
{
$basePath = realpath($custom);
@rodrigomanara
rodrigomanara / iwatch.service
Last active October 5, 2019 13:48
file sync with iwatch between multiple servers
[Unit]
Description=Iwatch trigger
After=network.target
StartLimitIntervalSec=0[Service]
Type=simple
Restart=always
RestartSec=1
User=ubuntu
ExecStart=/usr/bin/env php /path/to/server.php
@rodrigomanara
rodrigomanara / random_phone_number.php
Last active August 12, 2019 08:05
create a random phone number
<?php
class scramble{
/**
*
* @return type
*/
public function getRandonPhone($number_limit = 11)
{
@rodrigomanara
rodrigomanara / is_local.php
Created July 23, 2019 06:53
check if is localhost or not
<?php
function is_local() {
$url = get_site_url();
if (preg_match('/local/', $url)) {
return true;
}
return false;
}
@rodrigomanara
rodrigomanara / rody_shell_export_cats.php
Last active May 17, 2019 09:59
export categories from magento 1.9 via shell command
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
require_once 'abstract.php';
class Roddy_Shell_ExportCat extends Mage_Shell_Abstract {
Cut down your network
The trojan has raw file coming from /lib/libudev.so, it will copy and fork again. It will also add cron.hourly job named gcc.sh, then it will add initial script in your /etc/rc*.d (Debian, CentOS may be /etc/rc.d/{init,rc{1,2,3,4,5}}.d)
Use root to run the script below to change the folder privileges: chmod 0000 /lib/libudev.so && rm -rf /lib/libudev.so && chattr +i /lib/
Delete all /etc/rc{0,1,2,3,4,5,6,S}.d files which were created today, The name looks like S01????????.
Edit your crontab, delete the gcc.sh script in your /etc/cron.hourly, delete the gcc.sh file (/etc/cron.hourly/gcc.sh) then add privileges for your crontab: sed '/gcc.sh/d' /etc/crontab && chmod 0000 /etc/crontab && chattr +i /etc/crontab