This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Check if a given ip is in a network | |
| * @param string $ip IP to check in IPV4 format eg. 127.0.0.1 | |
| * @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed | |
| * @return boolean true if the ip is in this range / false if not. | |
| */ | |
| function ip_in_range( $ip, $range ) { | |
| if ( strpos( $range, '/' ) == false ) { | |
| $range .= '/32'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Usage example... | |
| HttpsURLConnection connection = (HttpsURLConnection) new URL("https://someurl.com").openConnection(); | |
| connection.setSSLSocketFactory(buildSslSocketFactory()); | |
| private static SSLSocketFactory buildSslSocketFactory(Context context) { | |
| // Add support for self-signed (local) SSL certificates | |
| // Based on http://developer.android.com/training/articles/security-ssl.html#UnknownCa | |
| try { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;(function() { | |
| var images = [].slice.call(document.querySelectorAll('img')) | |
| try { | |
| images.forEach(function(img) { | |
| downloadImage(img) | |
| }) | |
| } catch (e) { | |
| alert("Download failed."); | |
| console.log('Download failed.', e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ca.uwo.csd.cs2212.USERNAME; | |
| public class BankAccount { | |
| private double balance; | |
| public BankAccount(double balance) { | |
| this.balance = balance; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uci set wireless.radio0.channel=8 | |
| uci set wireless.radio0.htmode=HT40- | |
| uci set wireless.radio0.noscan=1 | |
| uci set wireless.radio0.bursting=1 | |
| uci set wireless.radio0.ff=1 | |
| uci set wireless.radio0.compression=1 | |
| uci set wireless.radio0.xr=1 | |
| uci set wireless.radio0.ar=1 | |
| uci set wireless.radio0.txpower=20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'openssl' | |
| require 'digest/md5' | |
| key = OpenSSL::PKey::RSA.new(2048) | |
| cipher = OpenSSL::Cipher::AES.new(256, :CBC) | |
| ctx = OpenSSL::SSL::SSLContext.new | |
| puts "Spoof must be in DER format and saved as root.cer" | |
| raw = File.read "root.cer" | |
| cert = OpenSSL::X509::Certificate.new raw | |
| cert.version = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The remote desktop session has to be headless :( | |
| - Install the deb (can convert with alien & co) | |
| - Patch with modern_distro.diff (cherry-pick what your system needs) | |
| - To support automatic desktop resizing: | |
| - Works with any window manager | |
| - Build Xvfb with xvfb-randr.diff | |
| - Expose as /usr/bin/Xvfb-randr | |
| - If replacing system-wide binary by repackaging, simply | |
| # ln -sf Xvfb /usr/bin/Xvfb-randr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Determine linux distribution and version | |
| cat /etc/issue | |
| cat /etc/*-release | |
| cat /etc/lsb-release | |
| cat /etc/redhat-release | |
| // Determine kernel version - 32 or 64-bit? | |
| cat /proc/version | |
| uname -a | |
| uname -mrs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // What system are we connected to? | |
| systeminfo | findstr /B /C:"OS Name" /C:"OS Version" | |
| // Get the hostname and username (if available) | |
| hostname | |
| echo %username% | |
| // Get users | |
| net users | |
| net user [username] |