Skip to content

Instantly share code, notes, and snippets.

@mkol5222
mkol5222 / gist:36825d63a8965f3c3de77c2fd3039bf2
Created September 5, 2017 19:26 — forked from felmoltor/gist:01e732dd1375f96114ed
Automatic malware download from malwaredomainlists.com and upload to virustotal.com and totalhash.com
# With this two lines of bash you will donwload the last malware samples extracted from the public lists of www.malwaredomainlist.com
# and you'll submit automatically the alive samples (check if the response was an executable or not) to totalhash.com (contribute to
# the community) and obtain the detection rate of the sample # from Virus Total (virustotal.com).
# As a result you'll get a bunch of executable files and their detection rate in the log "output.virustotal.txt"
# Download all the samples detected and listed in the public CSV of mdl.com
$ curl -s http://www.malwaredomainlist.com/mdlcsv.php | awk 'BEGIN {FS="\",\""} {print $2}' | strings -n 3 | grep -E "\.exe$|\.so$|\.bin$|\.src$|\.pdf$|\.docx$|\.vb$|\.sh$" | xargs -I% bash -c 'echo "Downloading: %" && curl -s -O %' | tee $(date +%Y%m%d_%H%M)_malware_download.log
# Upload the downloaded samples to totalhash.com and query virustotal.com with it MD5 checksum to obtain the detection ratio
$ ls *_malware_download.log -ltr | tail -n1 | cat $(awk '{pr
@mkol5222
mkol5222 / grafana_backup.sh
Created September 7, 2017 18:49 — forked from fbrnc/grafana_backup.sh
Grafana Backup
BASEURL=http://username:password@127.0.0.1:3000
for dash in $(curl -s -k "${BASEURL}/api/search" | jq -r '.[].title'); do
curl -k "${BASEURL}/api/dashboards/db/${dash}" > "${dash}.json"
done
@mkol5222
mkol5222 / grafana_setup.sh
Created September 7, 2017 19:00 — forked from avarabyeu/grafana_setup.sh
grafana_setup.sh
#!/bin/bash
./run.sh "${@}" &
timeout 10 bash -c "until </dev/tcp/localhost/3000; do sleep 1; done"
curl -s -H "Content-Type: application/json" \
-XPOST http://admin:admin@localhost:3000/api/datasources \
-d @- <<EOF
{
"name": "influx",
@mkol5222
mkol5222 / setup.md
Created July 12, 2018 07:55 — forked from davidbradway/setup.md
Set Up Docker On Raspberry Pi Raspbian Stretch Lite
@mkol5222
mkol5222 / dbusnetwatch.go
Created July 13, 2018 21:29 — forked from wiless/dbusnetwatch.go
Monitor for change of SSID/Connection
package main
import (
"fmt"
"os"
"github.com/godbus/dbus"
)
// dbus-monitor --system "type='signal',sender='org.freedesktop.NetworkManager',interface='org.freedesktop.NetworkManager'"
@mkol5222
mkol5222 / dbus_nm_ssid.py
Created July 13, 2018 21:30 — forked from hfs/dbus_nm_ssid.py
Query NetworkManager via DBUS in Python: Get the SSID of the active wireless connection
#!/usr/bin/env python
import dbus
NM = 'org.freedesktop.NetworkManager'
NMCA = NM + '.Connection.Active'
NMDW = NM + '.Device.Wireless'
NMAP = NM + '.AccessPoint'
DBUS_PROPS = 'org.freedesktop.DBus.Properties'
@mkol5222
mkol5222 / puckLight.js
Created November 15, 2018 08:55 — forked from navio/puckLight.js
PuckJS - Light switch
const LEDS = [LED1,LED2,LED3];
const onBtnClick =
(fn)=> setWatch(fn, BTN, {edge:"rising", debounce:50, repeat:true});
const turnOn = (el) => {
el.write(true);
};
const turnOff = (el) => {
@mkol5222
mkol5222 / Run Visual Studio Code for Linux from WSL.md
Created December 6, 2018 17:41 — forked from fedme/Run Visual Studio Code for Linux from WSL.md
Run Visual Studio Code for Linux from WSL on Windows 10

Run Visual Studio Code for Linux from WSL

Thanks a lot to mredbishop and others for their insturctions posted here. This is just a recap of what they figured out.

This process was tested on WSL Ubuntu 18.04.

Install VcXsrv on Windows

  1. Dowload the VcXsrv installer from https://sourceforge.net/projects/vcxsrv/
  2. Install the software on Windows

Add VS Code repositories

@mkol5222
mkol5222 / ws.ps1
Created November 26, 2021 11:52 — forked from byt3bl33d3r/ws.ps1
Async Websocket PowerShell client (producer/consumer pattern)
<#
References:
- https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocket?view=netframework-4.5
- https://github.com/poshbotio/PoshBot/blob/master/PoshBot/Implementations/Slack/SlackConnection.ps1
- https://www.leeholmes.com/blog/2018/09/05/producer-consumer-parallelism-in-powershell/
#>
$client_id = [System.GUID]::NewGuid()
$recv_queue = New-Object 'System.Collections.Concurrent.ConcurrentQueue[String]'
@mkol5222
mkol5222 / ConvertFrom-Xml.ps1
Created November 29, 2021 08:54 — forked from elvarb/ConvertFrom-Xml.ps1
Powershell to convert XML to JSON
# From https://stackoverflow.com/questions/42636510/convert-multiple-xmls-to-json-list
# Use
# [xml]$var = Get-Content file.xml
# Convert to JSON with
# $var | ConvertFrom-XML | ConvertTo-JSON -Depth 3
# Helper function that converts a *simple* XML document to a nested hashtable
# with ordered keys.
function ConvertFrom-Xml {
param([parameter(Mandatory, ValueFromPipeline)] [System.Xml.XmlNode] $node)