Skip to content

Instantly share code, notes, and snippets.

View jemmy655's full-sized avatar

Julius Emmanuel jemmy655

  • Jaysoftnet Technologies
  • Nigeria
View GitHub Profile
@jemmy655
jemmy655 / luhn.php
Created August 15, 2017 00:58
Simple PHP script to generate syntactically valid credit card numbers using the Luhn check. Also see http://en.wikipedia.org/wiki/Luhn_algorithm Not valid for making transactions anywhere!
<?
$bin = $_POST['bin'];
$length = $_POST['length'];
if ( $length == 0 )
$length = 16;
if ( $bin != '' )
$cardNumber = completed_number( $bin, $length );
@jemmy655
jemmy655 / README.md
Created June 14, 2016 23:14 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@jemmy655
jemmy655 / gist:ef3c102e2498f61e4858
Created March 10, 2016 08:03 — forked from codler/gist:3906826
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
@jemmy655
jemmy655 / setuid-root-backdoor.md
Created February 13, 2016 10:50 — forked from dergachev/setuid-root-backdoor.md
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

@jemmy655
jemmy655 / magnet-links-bittorrent.php
Created December 15, 2015 00:00 — forked from hakre/magnet-links-bittorrent.php
Magnet links library for PHP
@jemmy655
jemmy655 / curl_progress.php
Created December 10, 2015 18:18 — forked from bdunogier/curl_progress.php
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@jemmy655
jemmy655 / available_font-awesome_icons.php
Last active September 3, 2015 12:00 — forked from gubi/available_font-awesome_icons.php
Get all icons from a font-awesome.css file and list in json mode
<?php
/**
* Available Font Awesome icons
*
* Get all icons from a font-awesome.css file and list in json mode
*
* @author Alessandro Gubitosi <gubi.ale@iod.io>
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License, version 3
*/
<?php
// Code snippet to extract the icon from an exe file on a Linux system -- tested on Debian Wheezy
// Install icoutils on your system e.g. sudo apt-get install icoutils
// Web process must have write privileges to /tmp
///** Config **///
$input_file = '/path/to/program.exe';
@jemmy655
jemmy655 / displaySdt.c
Last active August 29, 2015 14:16 — forked from kimson/displaySdt.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define PID_SDT 0x0011
typedef struct ServiceDescriptorStructure {
unsigned char descriptor_tag;
unsigned char descriptor_length;