Skip to content

Instantly share code, notes, and snippets.

@jftuga
jftuga / pyautogui--move_mouse.py
Created February 5, 2018 04:22
PyAutoGUI Example #1
#!/usr/bin/env python3
import pyautogui
import time
for i in range(3):
print(i)
pyautogui.moveTo(100, 100, duration=0.25)
pyautogui.moveTo(200, 100, duration=0.25)
@jftuga
jftuga / pyautogui--screen_shot.py
Created February 5, 2018 04:23
PyAutoGUI Example #2
#!/usr/bin/env python3
import pyautogui
import time
###################################################################
# MacOS
def main():
@jftuga
jftuga / Test-is64bit.ps1
Created February 5, 2018 04:28
PowerShell Test-is64bit
function Test-is64Bit {
param($FilePath)
[int32]$MACHINE_OFFSET = 4
[int32]$PE_POINTER_OFFSET = 60
[byte[]]$data = New-Object -TypeName System.Byte[] -ArgumentList 4096
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList ($FilePath, 'Open', 'Read')
$stream.Read($data, 0, 4096) | Out-Null
@jftuga
jftuga / split.bat
Created February 14, 2018 20:34
Split a Windows Path into separate lines
@echo off
rem see also freq at: https://github.com/jftuga/universe/blob/master/freq.cs
rem see also mawk at: https://www.klabaster.com/freeware.htm
rem eample: dir ... | mawk .. | freq | less
dir "%1" /s/b | mawk "BEGIN{FS='\\';OFS='\n'} {$1=$1}1"
@jftuga
jftuga / lexar-improved.go
Last active August 21, 2018 16:53
Allow single quotes in goawk's printf family of functions
// Windows binary: https://github.com/jftuga/universe/tree/master/bin
//
// Package lexer is an AWK lexer (tokenizer).
//
// The lexer turns a string of AWK source code into a stream of
// tokens for parsing.
//
// To tokenize some source, create a new lexer with NewLexer(src) and
// then call Scan() until the token type is EOF or ILLEGAL.
//
@jftuga
jftuga / mping.cs
Last active November 30, 2018 09:50
multiping without admin privileges
/*
* Mulithreaded ping that does not require admin privileges
* Give IPs and/or hostnames on command-line
* The ping timeout is hard-coded to 100 ms, but can be changed by updating: pingTimeOut
*/
using System;
using System.Net;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
@jftuga
jftuga / sherlock_sort.py
Last active December 25, 2018 14:10
Sort entries in Sherlock data.json file
#!/usr/bin/env python3
# sort entries listed in https://github.com/sdushantha/sherlock/blob/master/data.json
import re
fname = "data.json"
site_re = re.compile('(".*?\},)',re.M|re.S)
name_re = re.compile('"(.*?)": \{')
@jftuga
jftuga / check_memory.ps1
Last active March 3, 2019 19:16
PowerShell check systems for processes using over 1 GB of memory
<#
check_memory.ps1
-John Taylor
Mar-3-2019
Interrogate all Windows systems listed in $disk_space_servers array for processes using over 1 GB
of 'WorkingSet64' memory and save the results to the file listed in $output
You can exclude "known processes" that will use more than 1 GB of memory by editing lines 32-35:
$over_mem_limit += ...
@jftuga
jftuga / vm_os.ps1
Created March 7, 2019 16:11
Get all VM Operating Systems with PowerCLI
$all | % { $_.Name + "`t" + $_.ExtensionData.Guest.GuestFullName } > vm.tsv
@jftuga
jftuga / tools.md
Created March 8, 2019 15:02
A few of my favorite things

I'd like to share with you some of my command-line tools that I have written to make my job easier. These are cross-platform (Windows, Linux, MacOS). I have also provided Windows binaries (usually found in a releases section). Most of my programs are either written in Python 3.5 or Go. My over-arching goal is to provide a self-contained, single binary or single .py file to maximize usability.


tcpscan

  • TCP Scan
  • A fast, simple, multi-threaded, cross-platform, IPv4 TCP port scanner

This is similar to nmap, but not nearly as feature rich. What I like about it is that it is just one file that I can use on any OS. It has a few features that nmap does not. If I want to scan all ports, I can use -p all instead of -p 1-65535. The -lo option will continually scan a port every second until it is open. Once opened, it will ring an audible bell and stop scanning. This is nice if I have to reboot a device and want to know when the service is back up and running.