This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env bash | |
| __fmt() { | |
| jq -r '.[] | [(.asn | [.asn, .name] | join(" ")), .country, .city, .ip] | join(" - ")' | |
| } | |
| __info() { | |
This line will replace the last octet of ipv4 adresses in a given file with a zero:
sed -i '' -e 's/(([0-9]{1,3}.){3})[0-9]{1,3}/\10/g'
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env python | |
| import sys | |
| if len(sys.argv) < 2: | |
| print "Enter IP address as first argument: python %s 127.0.0.1"%sys.argv[0] | |
| sys.exit(1) | |
| ip = sys.argv[1] | |
| ips = ip.split('.') | |
| iph = '0x{:02X}.0x{:02X}.0x{:02X}.0x{:02X}'.format(*map(int, ips)) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Based on gist https://gist.github.com/staaldraad/4c4c80800ce15b6bef1c1186eaa8da9f | |
| # - added TCP states | |
| awk 'BEGIN{states["01"]="TCP_ESTABLISHED" | |
| states["02"]="TCP_SYN_SENT" | |
| states["03"]="TCP_SYN_RECV" | |
| states["04"]="TCP_FIN_WAIT1" | |
| states["05"]="TCP_FIN_WAIT2" | |
| states["06"]="TCP_TIME_WAIT" | |
| states["07"]="TCP_CLOSE" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Gawk version | |
| # Remote | |
| grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}' | |
| # Local | |
| grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}' | |
| # No Gawk | |
| # Local | |
| grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | |----------|------------------------------------------------------|------------------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------------| | |
| | AS132203 | Tencent Building, Kejizhongyi Avenue | 1.12.0.0/20 | TENCENTCLOUD | Tencent cloud computing (Beijing) Co., Ltd. | CN | | |
| |----------|------------------------------------------------------|------------------|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|----------------| | |
| | AS132203 | Tencent Building, Kejizhongyi Avenue | 1.12.34.0/23 | TENCENTCLOUD | Tence | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Change execution policy: Set-ExecutionPolicy -Scope Process Unrestricted | |
| # Run this script, and then 'adb logcat | color-logcat' | |
| Function global:color-logcat { | |
| Process { | |
| if ($_) { | |
| $color = "White" | |
| $fgcolor = "Black" | |
| if($_ -match [regex]"\s[V]\s") { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/sh -u | |
| # To the extent possible under law, Viktor Szakats | |
| # has waived all copyright and related or neighboring rights to this | |
| # script. | |
| # CC0 - https://creativecommons.org/publicdomain/zero/1.0/ | |
| # Upload a file to Amazon AWS S3 using Signature Version 4 | |
| # | |
| # docs: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # --------------------------------------------------------------------------- | |
| # | |
| # Description: This file holds all my BASH configurations and aliases | |
| # | |
| # Sections: | |
| # 1. Environment Configuration | |
| # 2. Make Terminal Better (remapping defaults and adding functionality) | |
| # 3. File and Folder Management | |
| # 4. Searching | |
| # 5. Process Management |