Skip to content

Instantly share code, notes, and snippets.

View henri's full-sized avatar
💭
hacking the mainframe

henri henri

💭
hacking the mainframe
View GitHub Profile
@henri
henri / mac-network-commands-cheat-sheet.md
Last active June 8, 2021 20:50 — forked from jjnilton/mac-network-commands-cheat-sheet.md
Mac Network Commands Cheat Sheet

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

@henri
henri / networkonly.ruby
Last active September 24, 2021 04:22
Enable Only Specific Network Interfaces (macOS)
#!/usr/bin/env ruby
# this script will enable only the specified network interface
# a list of interfaces which were enabled will be recorded into
# the file /tmp/network_interfaces_[datestamp].txt
# released under the GNU GPL version 3 or later
# copyright henri shustak 2021
# See URL below for information on setting up networksetup access for non admin users
@henri
henri / RubyDNS_RuleBulder_ForceGoogleSafeSearch.ruby
Last active June 9, 2021 02:04
Ruby DNS Google Safe Search Rule Builder
#!/usr/bin/env ruby
# copyright 2021, henri shustak
# build google force safe search ruls for rubyDNS
google_domains = `curl https://www.google.com/supported_domains 2>> /dev/null | sed "s/^.//g"`.split("\n")
google_domains.each do | dom |
puts ""
#!/bin/bash
# This works on Ubuntu (likely other GNU/LINUX distributions as well - will test Arch shortly). BIND 9.1 or newer.
# flush it all
rndc flush
rndc reload
# flush single domain
rndc flushname cnn.com
@henri
henri / nmap_basic_cheat_sheet.txt
Last active January 29, 2025 22:08
nmap cheat sheet
#################
### using nmap
#################
# locate free IP addresses (powered off systems or non ARP reply will not be spotted) within a network - change network scan as needed
sudo nmap -v -sn -n 192.168.1.0/24 -oG - | awk '/Status: Down/{print $2}'
# reverse of above show the hosts which are up
sudo nmap -v -sn -n 192.168.1.0/24 -oG - | awk '/Status: Up/{print $2}'
@henri
henri / fortigate_basic_cheat_sheet.txt
Last active March 16, 2025 20:00
Fortigate Command Line Cheat Sheet
# get basic system informaton (including version)
get system status
# overview of hardware interfaces
get system interface physical
# details of a single network interface,
get hardware nic <nic-name>
# kind of hidden command to see more interface stats such as errors
@henri
henri / papercut_script_reject_jobs_not_redirected_snippit.javascript
Last active August 4, 2021 00:01
PaperCut Reject Jobs Not Redirected From Another Print Queue - PaperCut Application Server Printer Scripting
//
// Rejects Jobs Sent Directly, Redirected Jobs from other queues (eg. redirected from Find Me / Follow Me print queues will print as this script will not run on redirected jobs).
// Copyright Henri Shustak
// Licence : MIT <https://mit-license.org>
//
function printJobHook(inputs, actions) {
var username = inputs.job.username;
var printername = inputs.job.printerName;
var client_ip_address = inputs.job.clientIP;
@henri
henri / clone-gists.py
Created August 3, 2021 23:12 — forked from SpotlightKid/clone-gists.py
Clone all gists of GitHub username given on the command line.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Clone all gists of GitHub user with given username.
Clones all gist repos into the current directory, using the gist id as the
directory name. If the directory already exists as a git repo, try to perform a
'git pull' in it.
"""
# mosh (connection using specific public key-pair)
mosh --ssh="/usr/bin/ssh -i ~/.ssh/identity" [email protected]
@henri
henri / macOS logger cheat sheet
Last active October 4, 2021 23:58
macOS logger cheat sheet
# show syslog style notice level (from logger process)
log stream --process logger --level notice --style syslog
# show syslog style debug level
log stream --process logger --level debug --style syslog
# show syslog style info level
log stream --process logger --level info --style syslog