A collection of useful one liners that I have collected over time to help in extracting data, formatting data etc. Still a work in progress!
cat users.json
{
"nodes": [
{
"id": 400,
"type": "User",
"label": "[email protected]",
"props": {
"highvalue": false,
"sidhistory": {},
"passwordnotreqd": false,
"description": "Service Accounts",
"sensitive": false,
"unconstraineddelegation": false,
"pwdneverexpires": false,
"enabled": true,
"hasspn": false,
"domain": "umsundu.com",
"pwdlastset": 13607787938,
"displayname": "bob-324KL",
"name": "[email protected]",
"lastlogon": -1,
"distinguishedname": "CN=bob-324KL,OU=*****,DC=umsundu,DC=com",
"serviceprincipalnames": {},
"admincount": false,
"lastlogontimestamp": -1,
"objectid": "S-1-5-2*********************",
"dontreqpreauth": false
},
{
"id": 401,
"type": "User",
"label": "[email protected]",
"props": {
"highvalue": false,
"sidhistory": {},
"passwordnotreqd": false,
"description": "Service Accounts",
"sensitive": false,
"unconstraineddelegation": false,
"pwdneverexpires": false,
"enabled": true,
"hasspn": false,
"domain": "umsundu.com",
"pwdlastset": 13607787938,
"displayname": "sue-322JL",
"name": "[email protected]",
"lastlogon": -1,
"distinguishedname": "CN=sue-322JL,OU=*****,DC=umsundu,DC=com",
"serviceprincipalnames": {},
"admincount": false,
"lastlogontimestamp": -1,
"objectid": "S-1-5-2*********************",
"dontreqpreauth": false
},
grep -E -o "\b[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9.-]+\b" users.json | uniq
[email protected]
[email protected]
"C:\Users\Public\Old Desktop\tool.exe"
C:\Users\Public\Old Libraries\here.exe
"C:\Program Files\yes\321 123\testing.exe"
C:\ProgramFiles\btest\boom\boom.exe
C:\Program Files\KeePass Password Safe 2\XSL
C:\Program Files\btest we\boom\boom.exe
"C:\Program Files\yes\all good\good.exe"
grep -oP '^[^"]*\s[^"]*$' test.txt
C:\Users\Public\Old Libraries\here.exe
C:\Program Files\KeePass Password Safe 2\XSL
C:\Program Files\btest we\boom\boom.exe