Skip to content

Instantly share code, notes, and snippets.

@palefailmel
palefailmel / ubuntu_dropbox_initd
Created January 6, 2015 22:30
/etc/init.d/dropbox
start() {
echo "Starting dropbox..."
start-stop-daemon -b -o -c root -S -x /root/.dropbox-dist/dropboxd
}
stop() {
echo "Stopping dropbox..."
start-stop-daemon -o -c root -K -x /root/.dropbox-dist/dropboxd
}
status() {
dbpid=$(pgrep -u root dropbox)
# if 32 bit
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
# if 64 bit
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
@palefailmel
palefailmel / backup_sites.sh
Created January 6, 2015 22:14
simple backup script that backups some directories, and then saves them in one tarball and copies that one somewhere else.
#!/bin/bash
# Author: M. Stevenson
# Date : 2015-01-06
# Desc : Backup sites to local directory and put in tarball
# remove older backups
find ~/backups/* -mtime +30 -exec rm {} \;
BDIR=~/backups/
@palefailmel
palefailmel / FixInfected.vbs
Last active August 29, 2015 14:10
Reads a list of files that are infected with the Bluetooth.exe virus, and extracts the good exe, and renames the infected file.
' Author: Michael Stevenson
' Desc : Attempts to clean files infected by Bluetooth.exe. Depends on list from FindInfected.vbs
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Dim oldName
Dim newName
Dim oldPath
' Author: Michael Stevenson
' Desc : Uses a list of files, and attempts to find files infected with Bluetooth.exe
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim oldName
Set secondShell = WScript.CreateObject("WScript.Shell")
Set objShell = WScript.CreateObject("WScript.Shell")
Set logFile = objFSO.CreateTextFile("U:\VirusCleanup\infected_files.txt", True)
Set checkedFiles = objFSO.CreateTextFile("U:\VirusCleanup\checked_files.txt", True)
@palefailmel
palefailmel / HCExtras.ps1
Last active August 29, 2015 14:08
Simple PowerShell helper cmdlets to make some management things easier
#############################################################################
#
# Desc: Helper file to be dotted/imported in so that some things
# can be done a little bit easier
#
# Date: 2014-11-04 - M. Stevenson - Initial Version
# Added HC-EnableRDP, HC-EnterSession
#
#############################################################################
@palefailmel
palefailmel / Enable-RDP.ps1
Last active August 29, 2015 14:08
Enable PowerShell on a remote PC using WMI
#
# Author: M. Stevenson
# Desc : Enable RDP on a remote computer, given the hostname or IP
# Date : 2014-11-04 - M. Stevenson - Initial Version
#
Function Enable-RDP {
[CmdletBinding()]
param(
[parameter(Mandatory=$true,ValueFromPipeline=$true,HelpMessage="Enter the name/IP of the computer to enable RDP on")]
@palefailmel
palefailmel / Get-LockedOutUsers.ps1
Last active August 29, 2015 14:08
A simple way to search for locked out accounts that were probably locked out by a bad password in active directory
#
# Date : 2014-10-31 M. Stevenson - Initial Version
# Desc : Get users that were probably locked out by a
# bad password
#
Get-ADUser -Filter { LockoutTime -gt 0 -and BadPwdCount -ge 5 } -Properties * | sort lockouttime -descending | ForEach-Object {
$lockouttime = [DateTime]::FromFileTimeUtc($_.lockoutTime)
$bptime = [DateTime]::FromFileTimeUtc($_.badPasswordTime)
@palefailmel
palefailmel / hl7_msg_parser.js
Last active August 29, 2015 14:06
a WIP javascript based hl7 message parser.
if (typeof String.prototype.startsWith != 'function') {
String.prototype.startsWith = function (str) {
return this.indexOf(str) == 0;
};
}
function Message (data) {
this.data = data;
this.fieldsep = data.substring(3,4);
this.compsep = data.substring(4,5);
@palefailmel
palefailmel / hl7mlp_receiver.js
Created September 3, 2014 21:55
A simple node.js HL7 MLP server. Saves messages in files in a local folder, and generates ACK to send back to application.
/*
Author: Michael Stevenson
Date : 2014/09/03
Desc : Receive HL7 message from an MLP tcp interface on a specific port and ip.
Saves message to folder on PC. Constructs and sends ACK back to interface
*/
var net = require('net');
var fs = require('fs');