Skip to content

Instantly share code, notes, and snippets.

@yaci
yaci / google-drive-md5-checksum
Last active May 29, 2023 12:57
List google drive md5 checksum for all files
#!/usr/bin/python3
"""
!! IMPORTANT !!
!! READ THIS !!
In order to run this script you need python3 and pip3 installed.
You also need some additional python modules. Please run
sudo pip3 install httplib2 oauth2client
sudo pip3 install --upgrade google-api-python-client
// In case of "Exceeded maximum execution time" retry after some time
// Copied files and folders will not be copied again
// Changes:
// - Don't "search" for source and target folders
// - Inline some variables (to make it run faster)
// - Avoid Logger when possible (it can make script slower)
function start() {
var source = DriveApp.getFolderById('get-source-folder-id-in-link');
@dergachev
dergachev / setuid-root-backdoor.md
Last active March 16, 2024 00:49
How to use setuid to install a root backdoor.

Why You Can't Un-Root a Compromised Machine

Let's say somebody temporarily got root access to your system, whether because you "temporarily" gave them sudo rights, they guessed your password, or any other way. Even if you can disable their original method of accessing root, there's an infinite number of dirty tricks they can use to easily get it back in the future.

While the obvious tricks are easy to spot, like adding an entry to /root/.ssh/authorized_keys, or creating a new user, potentially via running malware, or via a cron job. I recently came across a rather subtle one that doesn't require changing any code, but instead exploits a standard feature of Linux user permissions system called setuid to subtly allow them to execute a root shell from any user account from the system (including www-data, which you might not even know if compromised).

If the "setuid bit" (or flag, or permission mode) is set for executable, the operating system will run not as the cur

@fnando
fnando / dev.conf
Created July 23, 2011 09:00
Nginx configuration for SSH tunnel
upstream tunnel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name dev.codeplane.com br.dev.codeplane.com;
location / {
proxy_set_header X-Real-IP $remote_addr;