Skip to content

Instantly share code, notes, and snippets.

@hscale
hscale / service-worker.js
Created December 19, 2019 16:52 — forked from arikanmstf/service-worker.js
Service Worker Example
self.addEventListener('push', function (event) {
if (event && event.data) {
const data = event.data.json();
event.waitUntil(self.registration.showNotification(data.title, {
body: data.body,
icon: data.icon || null
});
}
});
@hscale
hscale / sed cheatsheet
Created April 7, 2019 07:43 — forked from someguynamedmatt/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@hscale
hscale / Basckup_Web_Database_Server.sh
Created November 19, 2018 10:13 — forked from ashutoshsmaurya/Basckup_Web_Database_Server.sh
Backup Web Server and Database to Google Drive - Bash Script
#!/bin/bash
#Please note - This script tested on Centos-6,7/Redhat-6,7.
#Check Internet Connection
IS=`/bin/ping -c 5 4.2.2.2 | grep -c "64 bytes"`
if (test "$IS" -gt "2") then
internet_conn="1"
#Check Gdrive Software Install Or Not
file="/usr/bin/gdrive"
if [ -f "$file" ]
then
@hscale
hscale / repeatable-fields-metabox.php
Created July 18, 2017 03:48 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {

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. Will not work if proxied (source).

SECURITY BULLETIN AND UPDATES HERE: h

@hscale
hscale / MainActivity.java
Created March 13, 2017 02:17 — forked from granoeste/MainActivity.java
[Android] Button background change for state. (selector)
package com.example.sellectorsample;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener {
@hscale
hscale / worker nginx conf
Created January 12, 2017 21:39 — forked from fqrouter/worker nginx conf
Youtube Reverse Proxy
resolver 8.8.8.8;
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $1.googlevideo.com;
add_header Content-Disposition "attachment; filename=video.mp4;";
}
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;
@hscale
hscale / deobfuscate.py
Created September 19, 2016 13:15 — forked from quangnh89/deobfuscate.py
A malware analysis case-study: Deobfuscate Windows malicious obfuscated code
# Slide : https://docs.google.com/presentation/d/1jLUDucNtvGotHw0LOvDonMYwCkXYcb-cnsOWLNt-Ag0
import sys
import pefile
from capstone import *
from capstone.x86 import *
from keystone import *
from datetime import datetime
MAX_DISASM_COUNT = 1000 * 1000
FILE_NAME = r"dump-g4pic.dll"
@hscale
hscale / ALTERNATIVES.adoc
Created May 26, 2016 18:58 — forked from mbbx6spp/ALTERNATIVES.adoc
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
@hscale
hscale / bootstrap-3-vert-offset-shim.css
Created May 9, 2016 19:51 — forked from erobert17/bootstrap-3-vert-offset-shim.css
Adds a vertical offset top and bottom to Bootstrap 3 to be used within columns. Currently no vertical offset is available as standard in Bootstrap 3.
/*
Include this after bootstrap.css. Add class of
vert-offset-top-value or vert-offset-bottom-value
to your Bootstrap 3 default rows to prevent row content
from touching the row content above or below.
*/
/* Vertical Offset Bottom */
.vert-offset-top-12{
margin-top: 12em;