Skip to content

Instantly share code, notes, and snippets.

View aduzsardi's full-sized avatar
🛠️
d(0_0)b

Alexandru Duzsardi aduzsardi

🛠️
d(0_0)b
View GitHub Profile
@aduzsardi
aduzsardi / dscl_create_user.sh
Created July 25, 2017 07:32
osx create user with dscl
dscl . -create /Users/myuser
dscl . -create /Users/myuser UserShell /bin/zsh
dscl . -create /Users/myuser RealName "myuser"
dscl . -create /Users/myuser UniqueID "510"
dscl . -create /Users/myuser PrimaryGroupID 20
dscl . -create /Users/myuser NFSHomeDirectory /Users/myuser
dscl . -passwd /Users/myuser password
dscl . -append /Groups/admin GroupMembership myuser
@aduzsardi
aduzsardi / kadmin-fix
Created July 25, 2017 07:34
kadmin: GSS-API (or Kerberos) error while initializing kadmin interface
# kadmin: GSS-API (or Kerberos) error while initializing kadmin interface
install rng-tools
edit /etc/default/rng-tools
add line HRNGDEVICE=/dev/urandom , restart rng-tools service
edit /etc/init.d/krb5-admin-server , edit variable DAEMON_ARGS="-W /dev/urandom"
@aduzsardi
aduzsardi / lcap_bonding_setup
Created July 25, 2017 07:48
configure LCAP bonding Linux - Cisco IOS
# ---- START Cisco IOS ----
interface Port-channel2
description LACP Channel for mk2
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,2
switchport mode trunk
spanning-tree portfast trunk
!
interface GigabitEthernet1/0/23
description mk2 eth0
@aduzsardi
aduzsardi / dhcp_119_dns.ps1
Created July 25, 2017 07:51
generate dhcp option 119 (DNS Search Suffix) powershell script
# ----------------------------------------------------------------------------------------------------------
# PURPOSE: Creates a byte array for use with DHCP Option 119
#
# VERSION DATE USER DETAILS
# 1 07/03/2016 Craig Tolley First version
# 1.1 08/03/2016 Craig Tolley Fixed issue where if the whole domain matched the pointer was incorrect
# 1.2 08/03/2017 Craig Tolley Fixed further issues where the whole domain was matched the pointers are incorrect
# Modified outputs and tidied some formatting
# Convert-StringToOpt119Hex option fixed to not return values for null/empty strings
#
@aduzsardi
aduzsardi / gist:08a56c035ff3478d98e3e25d58e0b044
Created July 25, 2017 07:56
Viewing Truncated PowerShell Output
# Column Width
PS > Get-CsAnalogDevice | ft Identity,RegistrarPool -> Get-CsAnalogDevice | ft Identity,RegistrarPool | out-string -Width 160
# Collections / Arrays
# It might be that the object you’re looking at is an array (a “collection”), and PowerShell is only showing the first few entries in that array, rather than the lot.
# Here, the fix is to change the $FormatEnumerationLimit value. If you type it on its own into PowerShell the current value – probably 3 – will be returned. If you set a new value of -1, it’ll output ALL entries in your collection.
PS > $FormatEnumerationLimit
3
PS > $FormatEnumerationLimit=-1
@aduzsardi
aduzsardi / hping_examples
Created July 25, 2017 08:22
Hping usage examples
https://www.rationallyparanoid.com/articles/hping.html
Hping usage examples
Often considered a complementary tool to Nmap, hping is used for network scanning, as well as crafting TCP/IP packets. Please note that given the packet crafting involved, if you are running as root yet you receive an error saying that the operation is not permitted it could be due to a host firewall.
Send TCP SYN packets to port 0 on host example.com (note that hping will increment the source port by 1 for each packet sent):
hping example.com -S -V
Send TCP SYN packets to port 443 on host example.com:
hping example.com -S -V -p 443
@aduzsardi
aduzsardi / netcat_examples
Created July 25, 2017 08:24
Netcat usage examples
https://www.rationallyparanoid.com/articles/netcat.html
Netcat usage examples
The following commands were done on the Linux version of Netcat.
Connect to TCP port 80 on host example.com:
nc -vv example.com 80
Port scan TCP ports 7 through 1023 on host example.com
nc -v -z example.com 7-1023
@aduzsardi
aduzsardi / wget_examples
Created July 25, 2017 08:26
Wget usage examples
https://www.rationallyparanoid.com/articles/wget.html
Wget is a command-line tool for retrieving files using HTTP, HTTPS or FTP.
Retrieve /images/pic01.jpg from host example.com:
wget http://example.com/images/pic01.jpg
Retrieve /images/pic01.jpg from host example.com, specifying the user agent for IE7 on a Windows XP SP2 system instead of "Wget/1.xx":
wget --user-agent="Mozilla/4.0 (Windows; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)" http://example.com/images/pic01.jpg
Retrieve /images/pic01.jpg from host example.com, specifying "http://anothersite.example.com/search?hl=en&q=pictures" as the referer:
@aduzsardi
aduzsardi / Apple-Intel-Netboot
Created July 25, 2017 08:28
Getting *nix to Netboot Macs
http://brandon.penglase.net/index.php?title=Getting_*nix_to_Netboot_Macs
class "Apple-Intel-Netboot" {
2 # Limit this class to only Intel Apple machines
3 match if substring (option vendor-class-identifier, 0, 14) = "AAPLBSDPC/i386";
4 option dhcp-parameter-request-list 1,3,17,43,60; # Send these options to the client (possibly forcing it, if the client didn't request it)
5 # From: http://www.iana.org/assignments/bootp-dhcp-parameters/bootp-dhcp-parameters.xml
6 # 1 - Subnet Mask
7 # 3 - Router
8 # 17 - Root Path
@aduzsardi
aduzsardi / remote-gsettings-change
Created July 25, 2017 08:30
How to change Gsettings via remote shell
https://askubuntu.com/questions/457016/how-to-change-gsettings-via-remote-shell
#!/bin/bash
# Remember to run this script using the command "source ./filename.sh"
# Search these processes for the session variable
# (they are run as the current user and have the DBUS session variable set)
compatiblePrograms=( nautilus kdeinit kded4 pulseaudio trackerd )