Skip to content

Instantly share code, notes, and snippets.

@vietlq
vietlq / decrypt.py
Created October 9, 2017 22:16 — forked from vayn/decrypt.py
Example of PyCrypto AES decryption
import base64
import hashlib
import hmac
from Crypto.Cipher import AES
key = base64.decodebytes(b'v4QC6l4ttEogiBYvjLyvbA==')
nonce = base64.decodebytes(b'3iNVHJXuCfYoU9QP49DGqw==')
ct = base64.decodebytes(b'x9WM3Qy15Xw/2Z6pGVKXVA==')
@vietlq
vietlq / Rinkeby.md
Created October 5, 2017 20:33 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@vietlq
vietlq / Rinkeby.md
Created October 5, 2017 20:33 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@vietlq
vietlq / arduinoclock.cpp
Created August 23, 2017 18:51 — forked from Bravo555/arduinoclock.cpp
Arduino clock project
#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <LiquidCrystal_I2C.h>
int budzikGodzina = 7, budzikMinuta = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
tmElements_t tm;
@vietlq
vietlq / arduinoclock.cpp
Created August 23, 2017 18:51 — forked from Bravo555/arduinoclock.cpp
Arduino clock project
#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <LiquidCrystal_I2C.h>
int budzikGodzina = 7, budzikMinuta = 0;
LiquidCrystal_I2C lcd(0x27, 16, 2);
tmElements_t tm;
@vietlq
vietlq / .bash_profile
Last active July 3, 2017 05:50 — forked from molivier/gist:271bba5d67de1583a8e3
Set $GOPATH on Mac OSX : bash_profile
# Edit ~/.bash_profile
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
# Reload profile : source ~/.bash_profile

WannaCry|WannaDecrypt0r NSA-Cyberweapon-Powered Ransomware Worm

  • Virus Name: WannaCrypt, WannaCry, WanaCrypt0r, WCrypt, WCRY
  • Vector: All Windows versions before Windows 10 are vulnerable if not patched for MS-17-010. It uses EternalBlue MS17-010 to propagate.
  • Ransom: between $300 to $600. There is code to 'rm' (delete) files in the virus. Seems to reset if the virus crashes.
  • Backdooring: The worm loops through every RDP session on a system to run the ransomware as that user. It also installs the DOUBLEPULSAR backdoor. It corrupts shadow volumes to make recovery harder. (source: malwarebytes)
  • Kill switch: If the website www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com is up the virus exits instead of infecting the host. (source: malwarebytes). This domain has been sinkholed, stopping the spread of the worm.

SECURITY BULLETIN AND UPDATES HERE: https://technet.microsoft.com/en-us/library/security/ms17-010.aspx

@vietlq
vietlq / rm.js
Created May 2, 2017 21:53
recursive directory delete with promises (using rsvp) in node.js
var rsvp = require("rsvp")
var Promise = rsvp.Promise;
function cleardir(path) {
return new Promise(function(resolve, reject) {
fs.readdir(path, function(err, dir) {
if (err) {
reject(err);
return;
}
@vietlq
vietlq / mmap-fork.c
Created April 22, 2017 21:17 — forked from kashyapp/mmap-fork.c
sample code to test out fork and mmap of shared memory
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
@vietlq
vietlq / Virtual Box Host Only Static IP.md
Created April 15, 2017 20:50 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary