Skip to content

Instantly share code, notes, and snippets.

divinity76

Block or report user

Report or block divinity76

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View USB_badblocks.php
<?php
declare (strict_types = 1);
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
// INSTEAD USE https://gist.github.com/divinity76/605547aa19d244c5bd6016cc5d7f2402
View currency_convert_page.js
(function() {
"use strict";
let dollar_per_euro = 1.123;
let all = (function textNodesUnder(el) {
var n, a = [],
walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while (n = walk.nextNode()) a.push(n);
return a;
})(document.body);
let rex = /^\s*\€\s*(\d+(?:(?:\.|\,)\d+)?)\s*$/;
@divinity76
divinity76 / ssh_dictionary_attack.php
Created Jun 14, 2019
dictionary attack on ssh server..
View ssh_dictionary_attack.php
<?php
declare (strict_types = 1);
const CRACKSTATION_FILENAME = "crackstation.txt.gz";
const TARGET_IP='';
init();
// if ($argc !== 2) {
// die("{$argv[0]} X (method)\n");
// }
// $method = $argv[1];
// if ($method === "1") {
View hotmail_validator.php
<?php
declare (strict_types = 1);
require_once('hhb_.inc.php');
require_once('service_json.php'); // https://pear.php.net/package/Services_JSON
function is_hotmail_valid(string $hotmail)
{
$hc = new hhb_curl('', true);
$hc->setopt_array(array(CURLOPT_CONNECTTIMEOUT => 9, CURLOPT_TIMEOUT => 10)); // got a shitty internet connection :(
$hc->exec('https://login.live.com/login.srf');
$cookies = $hc->getResponseCookies();
View hash collision birthday paradox
https://preshing.com/20110504/hash-collision-probabilities/
given 2**32 possible hashes and 77163 samples, the chance of collision is 50%,
(function(){
let samples=2**32;// 77163
let hash_bytes=1;
for(;hash_bytes<30;++hash_bytes)
{
@divinity76
divinity76 / fps_counter.php
Last active May 25, 2019
count videogame fps by inspecting video stream frame-by-frame - suggested tolerance: 0.4
View fps_counter.php
<?php
declare (strict_types = 1);
//require_once('hhb_.inc.php');
const EXT = "png"; //jpg gives unreliable results (but significantly less disk space usage =/ )
init();
global $input_file, $tolerance;
// ffmpeg -i test_30.mp4 thumb%01d.png -hide_banner
$cmd = implode(" ", array(
escapeshellarg('ffmpeg'),
'-nostats',
@divinity76
divinity76 / qBitTorrent.php
Last active May 23, 2019
controlling qBitTorrent from php
View qBitTorrent.php
<?php
declare (strict_types = 1);
require_once('hhb_.inc.php'); // need hhb_curl from https://github.com/divinity76/hhb_.inc.php/blob/master/hhb_.inc.php
class QbitTorrent
{
protected $username = "admin";
protected $password = "123456";
protected $url = "http://127.0.0.1:8080";
/* @var hhb_curl $hc */
public $hc;
View video_cutter.php
<?php
declare (strict_types = 1);
stream_set_blocking(STDIN, true);
if ($argc >= 2) {
$in_file = $argv;
unset($in_file[0]);
$in_file = implode("", $in_file);
} else {
echo "choose path to media file: ";
$in_file = fgets(STDIN);
View misc PHP.php
<?php
function json_encode_pretty($data, int $extra_flags = 0, int $exclude_flags = 0): string
{
// prettiest flags for: 7.3.9
$flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | (defined("JSON_UNESCAPED_LINE_TERMINATORS") ? JSON_UNESCAPED_LINE_TERMINATORS : 0) | JSON_PRESERVE_ZERO_FRACTION | (defined("JSON_THROW_ON_ERROR") ? JSON_THROW_ON_ERROR : 0);
$flags = ($flags | $extra_flags) & ~ $exclude_flags;
return (json_encode($data, $flags));
}
@divinity76
divinity76 / 4chan_expand_all.js
Last active Apr 24, 2019
4chan expandAll - expand all thumbnailed images
View 4chan_expand_all.js
// why max? firefox has issues if you try to click 100+ images at the same time (chrome doesn't, but firefox does, why? idk)
function expandAllImages(max=3){
let all=document.querySelectorAll("div.file:not(.image-expanded) img:not(.autoexpanded)");
max=Math.min(max,all.length);
for(let i=0;i<max;++i){
all[i].className+=" autoexpanded";
all[i].click();
}
return max;
}
You can’t perform that action at this time.