diff --git a/README.md b/README.md index 7b989d4f..5bc90011 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # JC JSON CLI output utility -`jc` is used to JSONify the output of many standard linux cli tools for easier parsing in scripts. See the **Parsers** section for supported commands. +`jc` is used to JSONify the output of many standard linux cli tools and file types for easier parsing in scripts. See the **Parsers** section for supported commands. This allows further command line processing of output with tools like `jq` simply by piping commands: @@ -66,6 +66,7 @@ jc PARSER [OPTIONS] ### Parsers - `--arp` enables the `arp` parser - `--crontab` enables the `crontab` file parser +- `--crontab-u` enables the `crontab` file parser with user support - `--df` enables the `df` parser - `--dig` enables the `dig` parser - `--du` enables the `du` parser @@ -74,7 +75,9 @@ jc PARSER [OPTIONS] - `--fstab` enables the `/etc/fstab` file parser - `--history` enables the `history` parser - `--hosts` enables the `/etc/hosts` file parser +- `--id` enables the `id` parser - `--ifconfig` enables the `ifconfig` parser +- `--ini` enables the `INI` file parser - `--iptables` enables the `iptables` parser - `--jobs` enables the `jobs` parser - `--ls` enables the `ls` parser @@ -96,6 +99,8 @@ jc PARSER [OPTIONS] - `--uname` enables the `uname -a` parser - `--uptime` enables the `uptime` parser - `--w` enables the `w` parser +- `--xml` enables the `XML` file parser +- `--yaml` enables the `YAML` file parser ### Options - `-a` about `jc`. Prints information about `jc` and the parsers (in JSON, of course!) @@ -229,6 +234,82 @@ $ cat /etc/crontab | jc --crontab -p ] } ``` +### crontab-u (with user support) +``` +$ cat /etc/crontab | jc --crontab-u -p +{ + "variables": [ + { + "name": "MAILTO", + "value": "root" + }, + { + "name": "PATH", + "value": "/sbin:/bin:/usr/sbin:/usr/bin" + }, + { + "name": "SHELL", + "value": "/bin/bash" + } + ], + "schedule": [ + { + "minute": [ + "5" + ], + "hour": [ + "10-11", + "22" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "/var/www/devdaily.com/bin/mk-new-links.php" + }, + { + "minute": [ + "30" + ], + "hour": [ + "4/2" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "/var/www/devdaily.com/bin/create-all-backups.sh" + }, + { + "occurrence": "yearly", + "user": "root", + "command": "/home/maverick/bin/annual-maintenance" + }, + { + "occurrence": "reboot", + "user": "root", + "command": "/home/cleanup" + }, + { + "occurrence": "monthly", + "user": "root", + "command": "/home/maverick/bin/tape-backup" + } + ] +} +``` ### df ``` $ df | jc --df -p @@ -489,7 +570,7 @@ $ free | jc --free -p } ] ``` -### /etc/fstab +### /etc/fstab file ``` $ cat /etc/fstab | jc --fstab -p [ @@ -524,25 +605,25 @@ $ cat /etc/fstab | jc --fstab -p $ history | jc --history -p [ { - "line": "118", + "line": 118, "command": "sleep 100" }, { - "line": "119", + "line": 119, "command": "ls /bin" }, { - "line": "120", + "line": 120, "command": "echo \"hello\"" }, { - "line": "121", + "line": 121, "command": "docker images" }, ... ] ``` -### /etc/hosts +### /etc/hosts file ``` $ cat /etc/hosts | jc --hosts -p [ @@ -591,6 +672,36 @@ $ cat /etc/hosts | jc --hosts -p } ] ``` +### id +``` +$ id | jc --id -p +{ + "uid": { + "id": 1000, + "name": "joeuser" + }, + "gid": { + "id": 1000, + "name": "joeuser" + }, + "groups": [ + { + "id": 1000, + "name": "joeuser" + }, + { + "id": 10, + "name": "wheel" + } + ], + "context": { + "user": "unconfined_u", + "role": "unconfined_r", + "type": "unconfined_t", + "level": "s0-s0:c0.c1023" + } +} +``` ### ifconfig ``` $ ifconfig | jc --ifconfig -p @@ -662,6 +773,40 @@ $ ifconfig | jc --ifconfig -p } ] ``` +### INI files +``` +$ cat example.ini +[DEFAULT] +ServerAliveInterval = 45 +Compression = yes +CompressionLevel = 9 +ForwardX11 = yes + +[bitbucket.org] +User = hg + +[topsecret.server.com] +Port = 50022 +ForwardX11 = no + +$ cat example.ini | jc --ini -p +{ + "bitbucket.org": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "yes", + "user": "hg" + }, + "topsecret.server.com": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "no", + "port": "50022" + } +} +``` ### iptables ``` $ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p @@ -1599,6 +1744,110 @@ $ w | jc --w -p } ] ``` +### XML files +``` +$ cat cd_catalog.xml + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + Hide your heart + Bonnie Tyler + UK + CBS Records + 9.90 + 1988 + + ... + +$ cat cd_catalog.xml | jc --xml -p +{ + "CATALOG": { + "CD": [ + { + "TITLE": "Empire Burlesque", + "ARTIST": "Bob Dylan", + "COUNTRY": "USA", + "COMPANY": "Columbia", + "PRICE": "10.90", + "YEAR": "1985" + }, + { + "TITLE": "Hide your heart", + "ARTIST": "Bonnie Tyler", + "COUNTRY": "UK", + "COMPANY": "CBS Records", + "PRICE": "9.90", + "YEAR": "1988" + }, + ... +} +``` +### YAML files +``` +$ cat istio-mtls-permissive.yaml +apiVersion: "authentication.istio.io/v1alpha1" +kind: "Policy" +metadata: + name: "default" + namespace: "default" +spec: + peers: + - mtls: {} +--- +apiVersion: "networking.istio.io/v1alpha3" +kind: "DestinationRule" +metadata: + name: "default" + namespace: "default" +spec: + host: "*.default.svc.cluster.local" + trafficPolicy: + tls: + mode: ISTIO_MUTUAL + +$ cat istio-mtls-permissive.yaml | jc --yaml -p +[ + { + "apiVersion": "authentication.istio.io/v1alpha1", + "kind": "Policy", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "peers": [ + { + "mtls": {} + } + ] + } + }, + { + "apiVersion": "networking.istio.io/v1alpha3", + "kind": "DestinationRule", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "host": "*.default.svc.cluster.local", + "trafficPolicy": { + "tls": { + "mode": "ISTIO_MUTUAL" + } + } + } + } +] +``` ## TODO Future parsers: - /proc files @@ -1625,4 +1874,7 @@ Tested on: ## Acknowledgments - `ifconfig-parser` module from https://github.com/KnightWhoSayNi/ifconfig-parser +- `xmltodict` module from https://github.com/martinblech/xmltodict by Martín Blech +- `ruamel.yaml` library from https://pypi.org/project/ruamel.yaml by Anthon van der Neut - Parsing code from Conor Heine at https://gist.github.com/cahna/43a1a3ff4d075bcd71f9d7120037a501 adapted for some parsers +- Excellent constructive feedback from Ilya Sher (https://github.com/ilyash-b) diff --git a/changelog.txt b/changelog.txt index eeffbd59..30da0693 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,18 @@ jc changelog +20200205 v1.7.1 +- Add YAML file parser +- Add INI file parser +- Add XML file parser +- Add id parser (tested on linux and OSX) +- Add crontab file parser with user support (tested on linux) +- Add __version__ variable to parser modules +- Add exit code on error +- Updated history parser to output "line" as an integer +- Updated compatibility list for some parsers +- Bugfix in crontab file parser: header insertion was clobbering first row +- Just-in-time loading of parser modules instead of loading all at start + 20191217 v1.6.1 - Add du parser (tested on linux and OSX) - Add crontab parser (tested on linux and OSX) diff --git a/docgen.sh b/docgen.sh index f51267d4..149a671a 100755 --- a/docgen.sh +++ b/docgen.sh @@ -6,6 +6,7 @@ pydocmd simple jc+ > ../docs/readme.md pydocmd simple utils+ > ../docs/utils.md pydocmd simple jc.parsers.arp+ > ../docs/parsers/arp.md pydocmd simple jc.parsers.crontab+ > ../docs/parsers/crontab.md +pydocmd simple jc.parsers.crontab_u+ > ../docs/parsers/crontab_u.md pydocmd simple jc.parsers.df+ > ../docs/parsers/df.md pydocmd simple jc.parsers.dig+ > ../docs/parsers/dig.md pydocmd simple jc.parsers.du+ > ../docs/parsers/du.md @@ -14,7 +15,9 @@ pydocmd simple jc.parsers.free+ > ../docs/parsers/free.md pydocmd simple jc.parsers.fstab+ > ../docs/parsers/fstab.md pydocmd simple jc.parsers.history+ > ../docs/parsers/history.md pydocmd simple jc.parsers.hosts+ > ../docs/parsers/hosts.md +pydocmd simple jc.parsers.id+ > ../docs/parsers/id.md pydocmd simple jc.parsers.ifconfig+ > ../docs/parsers/ifconfig.md +pydocmd simple jc.parsers.ini+ > ../docs/parsers/ini.md pydocmd simple jc.parsers.iptables+ > ../docs/parsers/iptables.md pydocmd simple jc.parsers.jobs+ > ../docs/parsers/jobs.md pydocmd simple jc.parsers.ls+ > ../docs/parsers/ls.md @@ -36,3 +39,5 @@ pydocmd simple jc.parsers.systemctl_luf+ > ../docs/parsers/systemctl_luf.md pydocmd simple jc.parsers.uname+ > ../docs/parsers/uname.md pydocmd simple jc.parsers.uptime+ > ../docs/parsers/uptime.md pydocmd simple jc.parsers.w+ > ../docs/parsers/w.md +pydocmd simple jc.parsers.xml+ > ../docs/parsers/xml.md +pydocmd simple jc.parsers.yaml+ > ../docs/parsers/yaml.md diff --git a/docs/parsers/crontab.md b/docs/parsers/crontab.md index a078ce5c..98eb08e4 100644 --- a/docs/parsers/crontab.md +++ b/docs/parsers/crontab.md @@ -150,8 +150,8 @@ Returns: { "variables": [ - "name": string, - "value": string + "name": string, + "value": string ], "schedule": [ { diff --git a/docs/parsers/crontab_u.md b/docs/parsers/crontab_u.md new file mode 100644 index 00000000..7966d714 --- /dev/null +++ b/docs/parsers/crontab_u.md @@ -0,0 +1,199 @@ +# jc.parsers.crontab_u +jc - JSON CLI output utility crontab file Parser + +Usage: + + specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified + +Compatibility: + + 'linux', 'darwin', 'aix', 'freebsd' + +Examples: + + $ cat /etc/crontab | jc --crontab -p + { + "variables": [ + { + "name": "PATH", + "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + }, + { + "name": "SHELL", + "value": "/bin/sh" + } + ], + "schedule": [ + { + "minute": [ + "25" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )" + }, + { + "minute": [ + "47" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "7" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )" + }, + { + "minute": [ + "52" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "1" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )" + } + ] + } + + $ cat /etc/crontab | jc --crontab-u -p -r + { + "variables": [ + { + "name": "PATH", + "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + }, + { + "name": "SHELL", + "value": "/bin/sh" + } + ], + "schedule": [ + { + "minute": "25", + "hour": "6", + "day_of_month": "*", + "month": "*", + "day_of_week": "*", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )" + }, + { + "minute": "47", + "hour": "6", + "day_of_month": "*", + "month": "*", + "day_of_week": "7", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )" + }, + { + "minute": "52", + "hour": "6", + "day_of_month": "1", + "month": "*", + "day_of_week": "*", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )" + } + ] + } + + + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + Dictionary. Structured data with the following schema: + + { + "variables": [ + "name": string, + "value": string + ], + "schedule": [ + { + "occurrence" string, + "minute": [ + string + ], + "hour": [ + string + ], + "day_of_month": [ + string + ], + "month": [ + string + ], + "day_of_week": [ + string + ], + "occurrence": string, + "user": string, + "command": string + } + ] + } + + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + Dictionary. Raw or processed structured data. + diff --git a/docs/parsers/du.md b/docs/parsers/du.md index a7628ba4..b4184abe 100644 --- a/docs/parsers/du.md +++ b/docs/parsers/du.md @@ -7,7 +7,7 @@ Usage: Compatibility: - 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + 'linux', 'darwin', 'aix', 'freebsd' Examples: diff --git a/docs/parsers/history.md b/docs/parsers/history.md index d26332c9..5b828431 100644 --- a/docs/parsers/history.md +++ b/docs/parsers/history.md @@ -7,26 +7,26 @@ Usage: Compatibility: - 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' Examples: $ history | jc --history -p [ { - "line": "118", + "line": 118, "command": "sleep 100" }, { - "line": "119", + "line": 119, "command": "ls /bin" }, { - "line": "120", + "line": 120, "command": "echo "hello"" }, { - "line": "121", + "line": 121, "command": "docker images" }, ... @@ -63,7 +63,7 @@ Returns: [ { - "line": string, + "line": integer, "command": string } ] diff --git a/docs/parsers/id.md b/docs/parsers/id.md new file mode 100644 index 00000000..66775e46 --- /dev/null +++ b/docs/parsers/id.md @@ -0,0 +1,133 @@ +# jc.parsers.id +jc - JSON CLI output utility id Parser + +Usage: + + specify --id as the first argument if the piped input is coming from id + +Compatibility: + + 'linux', 'darwin', 'aix', 'freebsd' + +Examples: + + $ id | jc --id -p + { + "uid": { + "id": 1000, + "name": "joeuser" + }, + "gid": { + "id": 1000, + "name": "joeuser" + }, + "groups": [ + { + "id": 1000, + "name": "joeuser" + }, + { + "id": 10, + "name": "wheel" + } + ], + "context": { + "user": "unconfined_u", + "role": "unconfined_r", + "type": "unconfined_t", + "level": "s0-s0:c0.c1023" + } + } + + $ id | jc --id -p -r + { + "uid": { + "id": "1000", + "name": "joeuser" + }, + "gid": { + "id": "1000", + "name": "joeuser" + }, + "groups": [ + { + "id": "1000", + "name": "joeuser" + }, + { + "id": "10", + "name": "wheel" + } + ], + "context": { + "user": "unconfined_u", + "role": "unconfined_r", + "type": "unconfined_t", + "level": "s0-s0:c0.c1023" + } + } + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + Dictionary. Structured data with the following schema: + + { + "uid": { + "id": integer, + "name": string + }, + "gid": { + "id": integer, + "name": string + }, + "groups": [ + { + "id": integer, + "name": string + }, + { + "id": integer, + "name": string + } + ], + "context": { + "user": string, + "role": string, + "type": string, + "level": string + } + } + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + List of dictionaries. Raw or processed structured data. + diff --git a/docs/parsers/ini.md b/docs/parsers/ini.md new file mode 100644 index 00000000..41ecc5bc --- /dev/null +++ b/docs/parsers/ini.md @@ -0,0 +1,87 @@ +# jc.parsers.ini +jc - JSON CLI output utility INI Parser + +Usage: + + specify --ini as the first argument if the piped input is coming from an INI file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat example.ini + [DEFAULT] + ServerAliveInterval = 45 + Compression = yes + CompressionLevel = 9 + ForwardX11 = yes + + [bitbucket.org] + User = hg + + [topsecret.server.com] + Port = 50022 + ForwardX11 = no + + $ cat example.ini | jc --ini -p + { + "bitbucket.org": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "yes", + "user": "hg" + }, + "topsecret.server.com": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "no", + "port": "50022" + } + } + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + Dictionary representing an ini document: + + { + ini document converted to a dictionary + see configparser standard library documentation for more details + } + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + Dictionary representing the ini file + diff --git a/docs/parsers/xml.md b/docs/parsers/xml.md new file mode 100644 index 00000000..96044cf1 --- /dev/null +++ b/docs/parsers/xml.md @@ -0,0 +1,99 @@ +# jc.parsers.xml +jc - JSON CLI output utility XML Parser + +Usage: + + specify --xml as the first argument if the piped input is coming from an XML file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat cd_catalog.xml + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + Hide your heart + Bonnie Tyler + UK + CBS Records + 9.90 + 1988 + + ... + + $ cat cd_catalog.xml | jc --xml -p + { + "CATALOG": { + "CD": [ + { + "TITLE": "Empire Burlesque", + "ARTIST": "Bob Dylan", + "COUNTRY": "USA", + "COMPANY": "Columbia", + "PRICE": "10.90", + "YEAR": "1985" + }, + { + "TITLE": "Hide your heart", + "ARTIST": "Bonnie Tyler", + "COUNTRY": "UK", + "COMPANY": "CBS Records", + "PRICE": "9.90", + "YEAR": "1988" + }, + ... + } + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + Dictionary representing an XML document: + + { + XML Document converted to a Dictionary + See https://github.com/martinblech/xmltodict for details + } + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + Dictionary. Raw or processed structured data. + diff --git a/docs/parsers/yaml.md b/docs/parsers/yaml.md new file mode 100644 index 00000000..92a2eb16 --- /dev/null +++ b/docs/parsers/yaml.md @@ -0,0 +1,113 @@ +# jc.parsers.yaml +jc - JSON CLI output utility YAML Parser + +Usage: + + specify --yaml as the first argument if the piped input is coming from a YAML file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat istio-mtls-permissive.yaml + apiVersion: "authentication.istio.io/v1alpha1" + kind: "Policy" + metadata: + name: "default" + namespace: "default" + spec: + peers: + - mtls: {} + --- + apiVersion: "networking.istio.io/v1alpha3" + kind: "DestinationRule" + metadata: + name: "default" + namespace: "default" + spec: + host: "*.default.svc.cluster.local" + trafficPolicy: + tls: + mode: ISTIO_MUTUAL + + $ cat istio-mtls-permissive.yaml | jc --yaml -p + [ + { + "apiVersion": "authentication.istio.io/v1alpha1", + "kind": "Policy", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "peers": [ + { + "mtls": {} + } + ] + } + }, + { + "apiVersion": "networking.istio.io/v1alpha3", + "kind": "DestinationRule", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "host": "*.default.svc.cluster.local", + "trafficPolicy": { + "tls": { + "mode": "ISTIO_MUTUAL" + } + } + } + } + ] + +## info +```python +info(self, /, *args, **kwargs) +``` + +## process +```python +process(proc_data) +``` + +Final processing to conform to the schema. + +Parameters: + + proc_data: (dictionary) raw structured data to process + +Returns: + + List of dictionaries. Each dictionary represents a YAML document: + + [ + { + YAML Document converted to a Dictionary + See https://pypi.org/project/ruamel.yaml for details + } + ] + +## parse +```python +parse(data, raw=False, quiet=False) +``` + +Main text parsing function + +Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + +Returns: + + List of dictionaries. Raw or processed structured data. + diff --git a/jc/cli.py b/jc/cli.py index e81c5c5e..3594f24c 100644 --- a/jc/cli.py +++ b/jc/cli.py @@ -3,113 +3,121 @@ JC cli module """ import sys +import importlib import textwrap import signal import json import jc.utils -import jc.parsers.arp -import jc.parsers.crontab -import jc.parsers.df -import jc.parsers.dig -import jc.parsers.du -import jc.parsers.env -import jc.parsers.free -import jc.parsers.fstab -import jc.parsers.history -import jc.parsers.hosts -import jc.parsers.ifconfig -import jc.parsers.iptables -import jc.parsers.jobs -import jc.parsers.ls -import jc.parsers.lsblk -import jc.parsers.lsmod -import jc.parsers.lsof -import jc.parsers.mount -import jc.parsers.netstat -import jc.parsers.pip_list -import jc.parsers.pip_show -import jc.parsers.ps -import jc.parsers.route -import jc.parsers.ss -import jc.parsers.stat -import jc.parsers.systemctl -import jc.parsers.systemctl_lj -import jc.parsers.systemctl_ls -import jc.parsers.systemctl_luf -import jc.parsers.uname -import jc.parsers.uptime -import jc.parsers.w -parser_map = { - '--arp': jc.parsers.arp, - '--crontab': jc.parsers.crontab, - '--df': jc.parsers.df, - '--dig': jc.parsers.dig, - '--du': jc.parsers.du, - '--env': jc.parsers.env, - '--free': jc.parsers.free, - '--fstab': jc.parsers.fstab, - '--history': jc.parsers.history, - '--hosts': jc.parsers.hosts, - '--ifconfig': jc.parsers.ifconfig, - '--iptables': jc.parsers.iptables, - '--jobs': jc.parsers.jobs, - '--ls': jc.parsers.ls, - '--lsblk': jc.parsers.lsblk, - '--lsmod': jc.parsers.lsmod, - '--lsof': jc.parsers.lsof, - '--mount': jc.parsers.mount, - '--netstat': jc.parsers.netstat, - '--pip-list': jc.parsers.pip_list, - '--pip-show': jc.parsers.pip_show, - '--ps': jc.parsers.ps, - '--route': jc.parsers.route, - '--ss': jc.parsers.ss, - '--stat': jc.parsers.stat, - '--systemctl': jc.parsers.systemctl, - '--systemctl-lj': jc.parsers.systemctl_lj, - '--systemctl-ls': jc.parsers.systemctl_ls, - '--systemctl-luf': jc.parsers.systemctl_luf, - '--uname': jc.parsers.uname, - '--uptime': jc.parsers.uptime, - '--w': jc.parsers.w -} +parsers = [ + 'arp', + 'crontab', + 'crontab-u', + 'df', + 'dig', + 'du', + 'env', + 'free', + 'fstab', + 'history', + 'hosts', + 'id', + 'ifconfig', + 'ini', + 'iptables', + 'jobs', + 'ls', + 'lsblk', + 'lsmod', + 'lsof', + 'mount', + 'netstat', + 'pip-list', + 'pip-show', + 'ps', + 'route', + 'ss', + 'stat', + 'systemctl', + 'systemctl-lj', + 'systemctl-ls', + 'systemctl-luf', + 'uname', + 'uptime', + 'w', + 'xml', + 'yaml' +] + + +def parser_shortname(parser_argument): + """short name of the parser with dashes and no -- prefix""" + return parser_argument[2:] + + +def parser_argument(parser): + """short name of the parser with dashes and with -- prefix""" + return f'--{parser}' + + +def parser_mod_shortname(parser): + """short name of the parser's module name (no -- prefix and dashes converted to underscores)""" + return parser.replace('--', '').replace('-', '_') + + +def parser_module(parser): + """import the module just in time and present the module object""" + importlib.import_module('jc.parsers.' + parser_mod_shortname(parser)) + return getattr(jc.parsers, parser_mod_shortname(parser)) class info(): - version = '1.6.1' + version = '1.7.1' description = 'jc cli output JSON conversion tool' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' +__version__ = info.version + + def ctrlc(signum, frame): - exit() + sys.exit(1) -def parsers_text(): +def parsers_text(indent=0, pad=0): ptext = '' - for parser in parser_map: - if hasattr(parser_map[parser], 'info'): - padding = 16 - len(parser) + for parser in parsers: + parser_arg = parser_argument(parser) + parser_mod = parser_module(parser) + + if hasattr(parser_mod, 'info'): + parser_desc = parser_mod.info.description + padding = pad - len(parser_arg) padding_char = ' ' + indent_text = padding_char * indent padding_text = padding_char * padding - ptext += ' ' + parser + padding_text + parser_map[parser].info.description + '\n' + ptext += indent_text + parser_arg + padding_text + parser_desc + '\n' return ptext def about_jc(): parser_list = [] - for parser in parser_map: - if hasattr(parser_map[parser], 'info'): + + for parser in parsers: + parser_mod = parser_module(parser) + + if hasattr(parser_mod, 'info'): info_dict = {} - info_dict['name'] = parser_map[parser].__name__.split('.')[-1] - info_dict['argument'] = parser - parser_entry = vars(parser_map[parser].info) + info_dict['name'] = parser_mod.__name__.split('.')[-1] + info_dict['argument'] = parser_argument(parser) + parser_entry = vars(parser_mod.info) + for k, v in parser_entry.items(): if not k.startswith('__'): info_dict[k] = v + parser_list.append(info_dict) return { @@ -124,7 +132,7 @@ def about_jc(): def helptext(message): - parsers_string = parsers_text() + parsers_string = parsers_text(indent=12, pad=17) helptext_string = f''' jc: {message} @@ -134,11 +142,11 @@ def helptext(message): Parsers: {parsers_string} Options: - -a about jc - -d debug - show trace messages - -p pretty print output - -q quiet - suppress warnings - -r raw JSON output + -a about jc + -d debug - show trace messages + -p pretty print output + -q quiet - suppress warnings + -r raw JSON output Example: ls -al | jc --ls -p @@ -180,7 +188,7 @@ def main(): if sys.stdin.isatty(): helptext('missing piped data') - exit() + sys.exit(1) data = sys.stdin.read() @@ -188,25 +196,32 @@ def main(): if debug: for arg in sys.argv: - if arg in parser_map: - result = parser_map[arg].parse(data, raw=raw, quiet=quiet) + parser_name = parser_shortname(arg) + + if parser_name in parsers: + # load parser module just in time so we don't need to load all modules + parser = parser_module(arg) + result = parser.parse(data, raw=raw, quiet=quiet) found = True break else: for arg in sys.argv: - if arg in parser_map: + parser_name = parser_shortname(arg) + + if parser_name in parsers: + # load parser module just in time so we don't need to load all modules + parser = parser_module(arg) try: - result = parser_map[arg].parse(data, raw=raw, quiet=quiet) + result = parser.parse(data, raw=raw, quiet=quiet) found = True break except: - parser_name = parser_map[arg].__name__.split('.')[-1] jc.utils.error_message(f'{parser_name} parser could not parse the input data. Did you use the correct parser?\n For details use the -d option.') - exit(1) + sys.exit(1) if not found: helptext('missing or incorrect arguments') - exit() + sys.exit(1) json_out(result, pretty=pretty) diff --git a/jc/parsers/arp.py b/jc/parsers/arp.py index 1ff37f91..87960000 100644 --- a/jc/parsers/arp.py +++ b/jc/parsers/arp.py @@ -100,6 +100,9 @@ class info(): compatible = ['linux', 'aix', 'freebsd', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/crontab.py b/jc/parsers/crontab.py index fd82ce13..4336b0ef 100644 --- a/jc/parsers/crontab.py +++ b/jc/parsers/crontab.py @@ -132,7 +132,7 @@ import jc.parsers.universal class info(): - version = '1.0' + version = '1.1' description = 'crontab file parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -142,6 +142,9 @@ class info(): compatible = ['linux', 'darwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. @@ -156,8 +159,8 @@ def process(proc_data): { "variables": [ - "name": string, - "value": string + "name": string, + "value": string ], "schedule": [ { @@ -249,12 +252,12 @@ def parse(data, raw=False, quiet=False): 'command': cmd}) # Add header row for parsing - cleandata[0] = 'minute hour day_of_month month day_of_week command' + cleandata[:0] = ['minute hour day_of_month month day_of_week command'] if len(cleandata) > 1: cron_list = jc.parsers.universal.simple_table_parse(cleandata) - raw_output['schedule'] = cron_list + raw_output['schedule'] = cron_list # Add shortcut entries back in for item in shortcut_list: diff --git a/jc/parsers/crontab_u.py b/jc/parsers/crontab_u.py new file mode 100644 index 00000000..c11a1049 --- /dev/null +++ b/jc/parsers/crontab_u.py @@ -0,0 +1,273 @@ +"""jc - JSON CLI output utility crontab file Parser + +Usage: + + specify --crontab-u as the first argument if the piped input is coming from a crontab file with User specified + +Compatibility: + + 'linux', 'darwin', 'aix', 'freebsd' + +Examples: + + $ cat /etc/crontab | jc --crontab -p + { + "variables": [ + { + "name": "PATH", + "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + }, + { + "name": "SHELL", + "value": "/bin/sh" + } + ], + "schedule": [ + { + "minute": [ + "25" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )" + }, + { + "minute": [ + "47" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "*" + ], + "month": [ + "*" + ], + "day_of_week": [ + "7" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )" + }, + { + "minute": [ + "52" + ], + "hour": [ + "6" + ], + "day_of_month": [ + "1" + ], + "month": [ + "*" + ], + "day_of_week": [ + "*" + ], + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )" + } + ] + } + + $ cat /etc/crontab | jc --crontab-u -p -r + { + "variables": [ + { + "name": "PATH", + "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + }, + { + "name": "SHELL", + "value": "/bin/sh" + } + ], + "schedule": [ + { + "minute": "25", + "hour": "6", + "day_of_month": "*", + "month": "*", + "day_of_week": "*", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )" + }, + { + "minute": "47", + "hour": "6", + "day_of_month": "*", + "month": "*", + "day_of_week": "7", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )" + }, + { + "minute": "52", + "hour": "6", + "day_of_month": "1", + "month": "*", + "day_of_week": "*", + "user": "root", + "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )" + } + ] + } + + +""" +import jc.utils +import jc.parsers.universal + + +class info(): + version = '1.0' + description = 'crontab file parser with user support' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + # details = 'enter any other details here' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'aix', 'freebsd'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + Dictionary. Structured data with the following schema: + + { + "variables": [ + "name": string, + "value": string + ], + "schedule": [ + { + "occurrence" string, + "minute": [ + string + ], + "hour": [ + string + ], + "day_of_month": [ + string + ], + "month": [ + string + ], + "day_of_week": [ + string + ], + "occurrence": string, + "user": string, + "command": string + } + ] + } + + """ + # put itmes in lists + try: + for entry in proc_data['schedule']: + entry['minute'] = entry['minute'].split(',') + entry['hour'] = entry['hour'].split(',') + entry['day_of_month'] = entry['day_of_month'].split(',') + entry['month'] = entry['month'].split(',') + entry['day_of_week'] = entry['day_of_week'].split(',') + except (KeyError): + pass + + return proc_data + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + Dictionary. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = {} + cleandata = data.splitlines() + + # Clear any blank lines + cleandata = list(filter(None, cleandata)) + + # Clear any commented lines + for i, line in reversed(list(enumerate(cleandata))): + if line.strip().find('#') == 0: + cleandata.pop(i) + + # Pop any variable assignment lines + cron_var = [] + for i, line in reversed(list(enumerate(cleandata))): + if line.find('=') != -1: + var_line = cleandata.pop(i) + var_name = var_line.split('=', maxsplit=1)[0].strip() + var_value = var_line.split('=', maxsplit=1)[1].strip() + cron_var.append({'name': var_name, + 'value': var_value}) + + raw_output['variables'] = cron_var + + # Pop any shortcut lines + shortcut_list = [] + for i, line in reversed(list(enumerate(cleandata))): + if line.strip().startswith('@'): + shortcut_line = cleandata.pop(i) + occurrence = shortcut_line.split(maxsplit=1)[0].strip().lstrip('@') + usr = shortcut_line.split(maxsplit=2)[1].strip() + cmd = shortcut_line.split(maxsplit=2)[2].strip() + shortcut_list.append({'occurrence': occurrence, + 'user': usr, + 'command': cmd}) + + # Add header row for parsing + cleandata[:0] = ['minute hour day_of_month month day_of_week user command'] + + if len(cleandata) > 1: + cron_list = jc.parsers.universal.simple_table_parse(cleandata) + + raw_output['schedule'] = cron_list + + # Add shortcut entries back in + for item in shortcut_list: + raw_output['schedule'].append(item) + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/jc/parsers/df.py b/jc/parsers/df.py index 91747915..379b3cc4 100644 --- a/jc/parsers/df.py +++ b/jc/parsers/df.py @@ -82,6 +82,9 @@ class info(): compatible = ['linux', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/dig.py b/jc/parsers/dig.py index 2a62b871..b381483e 100644 --- a/jc/parsers/dig.py +++ b/jc/parsers/dig.py @@ -333,6 +333,9 @@ class info(): compatible = ['linux', 'aix', 'freebsd', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/du.py b/jc/parsers/du.py index 2ddf2a33..c21eec8e 100644 --- a/jc/parsers/du.py +++ b/jc/parsers/du.py @@ -6,7 +6,7 @@ Usage: Compatibility: - 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + 'linux', 'darwin', 'aix', 'freebsd' Examples: @@ -73,14 +73,17 @@ import jc.parsers.universal class info(): - version = '1.0' + version = '1.1' description = 'du parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' # details = 'enter any other details here' # compatible options: linux, darwin, cygwin, win32, aix, freebsd - compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + compatible = ['linux', 'darwin', 'aix', 'freebsd'] + + +__version__ = info.version def process(proc_data): diff --git a/jc/parsers/env.py b/jc/parsers/env.py index 8aa9eb36..86931c2e 100644 --- a/jc/parsers/env.py +++ b/jc/parsers/env.py @@ -61,6 +61,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/foo.py b/jc/parsers/foo.py index cabe7c44..983fe6d8 100644 --- a/jc/parsers/foo.py +++ b/jc/parsers/foo.py @@ -30,6 +30,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/free.py b/jc/parsers/free.py index f39d558a..5deeb802 100644 --- a/jc/parsers/free.py +++ b/jc/parsers/free.py @@ -62,6 +62,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/fstab.py b/jc/parsers/fstab.py index 7d775da2..f8c79f2f 100644 --- a/jc/parsers/fstab.py +++ b/jc/parsers/fstab.py @@ -79,6 +79,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/history.py b/jc/parsers/history.py index 7f897f31..09950578 100644 --- a/jc/parsers/history.py +++ b/jc/parsers/history.py @@ -6,26 +6,26 @@ Usage: Compatibility: - 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + 'linux', 'darwin', 'cygwin', 'aix', 'freebsd' Examples: $ history | jc --history -p [ { - "line": "118", + "line": 118, "command": "sleep 100" }, { - "line": "119", + "line": 119, "command": "ls /bin" }, { - "line": "120", + "line": 120, "command": "echo \"hello\"" }, { - "line": "121", + "line": 121, "command": "docker images" }, ... @@ -50,7 +50,10 @@ class info(): author_email = 'kellyjonbrazil@gmail.com' # compatible options: linux, darwin, cygwin, win32, aix, freebsd - compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] + + +__version__ = info.version def process(proc_data): @@ -67,7 +70,7 @@ def process(proc_data): [ { - "line": string, + "line": integer, "command": string } ] @@ -81,6 +84,16 @@ def process(proc_data): proc_line['command'] = v processed.append(proc_line) + for entry in processed: + int_list = ['line'] + for key in int_list: + if key in entry: + try: + key_int = int(entry[key]) + entry[key] = key_int + except (ValueError): + entry[key] = None + return processed diff --git a/jc/parsers/hosts.py b/jc/parsers/hosts.py index 00e89e96..3d3a6776 100644 --- a/jc/parsers/hosts.py +++ b/jc/parsers/hosts.py @@ -70,6 +70,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/id.py b/jc/parsers/id.py new file mode 100644 index 00000000..42b7ff7c --- /dev/null +++ b/jc/parsers/id.py @@ -0,0 +1,214 @@ +"""jc - JSON CLI output utility id Parser + +Usage: + + specify --id as the first argument if the piped input is coming from id + +Compatibility: + + 'linux', 'darwin', 'aix', 'freebsd' + +Examples: + + $ id | jc --id -p + { + "uid": { + "id": 1000, + "name": "joeuser" + }, + "gid": { + "id": 1000, + "name": "joeuser" + }, + "groups": [ + { + "id": 1000, + "name": "joeuser" + }, + { + "id": 10, + "name": "wheel" + } + ], + "context": { + "user": "unconfined_u", + "role": "unconfined_r", + "type": "unconfined_t", + "level": "s0-s0:c0.c1023" + } + } + + $ id | jc --id -p -r + { + "uid": { + "id": "1000", + "name": "joeuser" + }, + "gid": { + "id": "1000", + "name": "joeuser" + }, + "groups": [ + { + "id": "1000", + "name": "joeuser" + }, + { + "id": "10", + "name": "wheel" + } + ], + "context": { + "user": "unconfined_u", + "role": "unconfined_r", + "type": "unconfined_t", + "level": "s0-s0:c0.c1023" + } + } +""" +import jc.utils + + +class info(): + version = '1.0' + description = 'id parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + # details = 'enter any other details here' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'aix', 'freebsd'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + Dictionary. Structured data with the following schema: + + { + "uid": { + "id": integer, + "name": string + }, + "gid": { + "id": integer, + "name": string + }, + "groups": [ + { + "id": integer, + "name": string + }, + { + "id": integer, + "name": string + } + ], + "context": { + "user": string, + "role": string, + "type": string, + "level": string + } + } + """ + if 'uid' in proc_data: + if 'id' in proc_data['uid']: + try: + proc_data['uid']['id'] = int(proc_data['uid']['id']) + except (ValueError): + proc_data['uid']['id'] = None + + if 'gid' in proc_data: + if 'id' in proc_data['gid']: + try: + proc_data['gid']['id'] = int(proc_data['gid']['id']) + except (ValueError): + proc_data['gid']['id'] = None + + if 'groups' in proc_data: + for group in proc_data['groups']: + if 'id' in group: + try: + group['id'] = int(group['id']) + except (ValueError): + group['id'] = None + + return proc_data + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + List of dictionaries. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = {} + cleandata = data.split() + + # Clear any blank lines + cleandata = list(filter(None, cleandata)) + + if cleandata: + for section in cleandata: + if section.startswith('uid'): + uid_parsed = section.replace('(', '=').replace(')', '=') + uid_parsed = uid_parsed.split('=') + raw_output['uid'] = {} + raw_output['uid']['id'] = uid_parsed[1] + raw_output['uid']['name'] = uid_parsed[2] + + if section.startswith('gid'): + gid_parsed = section.replace('(', '=').replace(')', '=') + gid_parsed = gid_parsed.split('=') + raw_output['gid'] = {} + raw_output['gid']['id'] = gid_parsed[1] + raw_output['gid']['name'] = gid_parsed[2] + + if section.startswith('groups'): + groups_parsed = section.replace('(', '=').replace(')', '=') + groups_parsed = groups_parsed.replace('groups=', '') + groups_parsed = groups_parsed.split(',') + raw_output['groups'] = [] + + for group in groups_parsed: + group_dict = {} + grp_parsed = group.split('=') + group_dict['id'] = grp_parsed[0] + group_dict['name'] = grp_parsed[1] + raw_output['groups'].append(group_dict) + + if section.startswith('context'): + context_parsed = section.replace('context=', '') + context_parsed = context_parsed.split(':', maxsplit=3) + raw_output['context'] = {} + raw_output['context']['user'] = context_parsed[0] + raw_output['context']['role'] = context_parsed[1] + raw_output['context']['type'] = context_parsed[2] + raw_output['context']['level'] = context_parsed[3] + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/jc/parsers/ifconfig.py b/jc/parsers/ifconfig.py index ce69da71..633050ff 100644 --- a/jc/parsers/ifconfig.py +++ b/jc/parsers/ifconfig.py @@ -156,6 +156,9 @@ class info(): compatible = ['linux', 'aix', 'freebsd', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/ini.py b/jc/parsers/ini.py new file mode 100644 index 00000000..731d4b7f --- /dev/null +++ b/jc/parsers/ini.py @@ -0,0 +1,112 @@ +"""jc - JSON CLI output utility INI Parser + +Usage: + + specify --ini as the first argument if the piped input is coming from an INI file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat example.ini + [DEFAULT] + ServerAliveInterval = 45 + Compression = yes + CompressionLevel = 9 + ForwardX11 = yes + + [bitbucket.org] + User = hg + + [topsecret.server.com] + Port = 50022 + ForwardX11 = no + + $ cat example.ini | jc --ini -p + { + "bitbucket.org": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "yes", + "user": "hg" + }, + "topsecret.server.com": { + "serveraliveinterval": "45", + "compression": "yes", + "compressionlevel": "9", + "forwardx11": "no", + "port": "50022" + } + } +""" +import jc.utils +import configparser + + +class info(): + version = '1.0' + description = 'INI file parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + details = 'Using configparser from the standard library' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + Dictionary representing an ini document: + + { + ini document converted to a dictionary + see configparser standard library documentation for more details + } + """ + + # No further processing + return proc_data + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + Dictionary representing the ini file + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = {} + + if data: + ini = configparser.ConfigParser() + ini.read_string(data) + raw_output = {s: dict(ini.items(s)) for s in ini.sections()} + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/jc/parsers/iptables.py b/jc/parsers/iptables.py index 53806eba..380ceb63 100644 --- a/jc/parsers/iptables.py +++ b/jc/parsers/iptables.py @@ -143,6 +143,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/jobs.py b/jc/parsers/jobs.py index 476e754e..27760553 100644 --- a/jc/parsers/jobs.py +++ b/jc/parsers/jobs.py @@ -86,6 +86,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/ls.py b/jc/parsers/ls.py index 4c68ac48..9b5485bf 100644 --- a/jc/parsers/ls.py +++ b/jc/parsers/ls.py @@ -153,6 +153,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/lsblk.py b/jc/parsers/lsblk.py index 29e1b354..38bb6508 100644 --- a/jc/parsers/lsblk.py +++ b/jc/parsers/lsblk.py @@ -225,6 +225,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/lsmod.py b/jc/parsers/lsmod.py index b179adc3..9cbf0f62 100644 --- a/jc/parsers/lsmod.py +++ b/jc/parsers/lsmod.py @@ -116,6 +116,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/lsof.py b/jc/parsers/lsof.py index d7ed7b1b..97a92fc3 100644 --- a/jc/parsers/lsof.py +++ b/jc/parsers/lsof.py @@ -106,6 +106,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/mount.py b/jc/parsers/mount.py index ac95624f..e265b10e 100644 --- a/jc/parsers/mount.py +++ b/jc/parsers/mount.py @@ -65,6 +65,9 @@ class info(): compatible = ['linux', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/netstat.py b/jc/parsers/netstat.py index 5caf9141..a7bc00f8 100644 --- a/jc/parsers/netstat.py +++ b/jc/parsers/netstat.py @@ -322,6 +322,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/pip_list.py b/jc/parsers/pip_list.py index cabd6d8a..e7d1e96a 100644 --- a/jc/parsers/pip_list.py +++ b/jc/parsers/pip_list.py @@ -33,7 +33,7 @@ import jc.parsers.universal class info(): version = '1.0' - description = 'pip-list parser' + description = 'pip list parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -41,6 +41,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/pip_show.py b/jc/parsers/pip_show.py index 554a65af..6d085832 100644 --- a/jc/parsers/pip_show.py +++ b/jc/parsers/pip_show.py @@ -43,7 +43,7 @@ import jc.utils class info(): version = '1.0' - description = 'pip-show parser' + description = 'pip show parser' author = 'Kelly Brazil' author_email = 'kellyjonbrazil@gmail.com' @@ -51,6 +51,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/ps.py b/jc/parsers/ps.py index feac622c..05c8bfe7 100644 --- a/jc/parsers/ps.py +++ b/jc/parsers/ps.py @@ -186,6 +186,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/route.py b/jc/parsers/route.py index 1d7bc0b0..7921edd7 100644 --- a/jc/parsers/route.py +++ b/jc/parsers/route.py @@ -110,6 +110,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/ss.py b/jc/parsers/ss.py index a3c2b51a..05a6e5df 100644 --- a/jc/parsers/ss.py +++ b/jc/parsers/ss.py @@ -260,6 +260,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/stat.py b/jc/parsers/stat.py index c466efab..72283c3a 100644 --- a/jc/parsers/stat.py +++ b/jc/parsers/stat.py @@ -113,6 +113,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/systemctl.py b/jc/parsers/systemctl.py index 792357f6..d9cec6dd 100644 --- a/jc/parsers/systemctl.py +++ b/jc/parsers/systemctl.py @@ -49,6 +49,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/systemctl_lj.py b/jc/parsers/systemctl_lj.py index 390b436f..fa2c1a68 100644 --- a/jc/parsers/systemctl_lj.py +++ b/jc/parsers/systemctl_lj.py @@ -68,6 +68,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/systemctl_ls.py b/jc/parsers/systemctl_ls.py index de48a431..ce01b91a 100644 --- a/jc/parsers/systemctl_ls.py +++ b/jc/parsers/systemctl_ls.py @@ -43,6 +43,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/systemctl_luf.py b/jc/parsers/systemctl_luf.py index b9995481..e169da5f 100644 --- a/jc/parsers/systemctl_luf.py +++ b/jc/parsers/systemctl_luf.py @@ -40,6 +40,9 @@ class info(): compatible = ['linux'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/uname.py b/jc/parsers/uname.py index cfff2968..1c4a6876 100644 --- a/jc/parsers/uname.py +++ b/jc/parsers/uname.py @@ -39,6 +39,9 @@ class info(): compatible = ['linux', 'darwin'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/uptime.py b/jc/parsers/uptime.py index c0f97f88..61a05508 100644 --- a/jc/parsers/uptime.py +++ b/jc/parsers/uptime.py @@ -43,6 +43,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/w.py b/jc/parsers/w.py index d98c746a..8bae56e7 100644 --- a/jc/parsers/w.py +++ b/jc/parsers/w.py @@ -92,6 +92,9 @@ class info(): compatible = ['linux', 'darwin', 'cygwin', 'aix', 'freebsd'] +__version__ = info.version + + def process(proc_data): """ Final processing to conform to the schema. diff --git a/jc/parsers/xml.py b/jc/parsers/xml.py new file mode 100644 index 00000000..5853421a --- /dev/null +++ b/jc/parsers/xml.py @@ -0,0 +1,120 @@ +"""jc - JSON CLI output utility XML Parser + +Usage: + + specify --xml as the first argument if the piped input is coming from an XML file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat cd_catalog.xml + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + Hide your heart + Bonnie Tyler + UK + CBS Records + 9.90 + 1988 + + ... + + $ cat cd_catalog.xml | jc --xml -p + { + "CATALOG": { + "CD": [ + { + "TITLE": "Empire Burlesque", + "ARTIST": "Bob Dylan", + "COUNTRY": "USA", + "COMPANY": "Columbia", + "PRICE": "10.90", + "YEAR": "1985" + }, + { + "TITLE": "Hide your heart", + "ARTIST": "Bonnie Tyler", + "COUNTRY": "UK", + "COMPANY": "CBS Records", + "PRICE": "9.90", + "YEAR": "1988" + }, + ... + } +""" +import jc.utils +import xmltodict + + +class info(): + version = '1.0' + description = 'XML file parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + details = 'Using the xmltodict library at https://github.com/martinblech/xmltodict' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + Dictionary representing an XML document: + + { + XML Document converted to a Dictionary + See https://github.com/martinblech/xmltodict for details + } + """ + + # No further processing + return proc_data + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + Dictionary. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + if data: + raw_output = xmltodict.parse(data) + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/jc/parsers/yaml.py b/jc/parsers/yaml.py new file mode 100644 index 00000000..9da30bae --- /dev/null +++ b/jc/parsers/yaml.py @@ -0,0 +1,137 @@ +"""jc - JSON CLI output utility YAML Parser + +Usage: + + specify --yaml as the first argument if the piped input is coming from a YAML file + +Compatibility: + + 'linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd' + +Examples: + + $ cat istio-mtls-permissive.yaml + apiVersion: "authentication.istio.io/v1alpha1" + kind: "Policy" + metadata: + name: "default" + namespace: "default" + spec: + peers: + - mtls: {} + --- + apiVersion: "networking.istio.io/v1alpha3" + kind: "DestinationRule" + metadata: + name: "default" + namespace: "default" + spec: + host: "*.default.svc.cluster.local" + trafficPolicy: + tls: + mode: ISTIO_MUTUAL + + $ cat istio-mtls-permissive.yaml | jc --yaml -p + [ + { + "apiVersion": "authentication.istio.io/v1alpha1", + "kind": "Policy", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "peers": [ + { + "mtls": {} + } + ] + } + }, + { + "apiVersion": "networking.istio.io/v1alpha3", + "kind": "DestinationRule", + "metadata": { + "name": "default", + "namespace": "default" + }, + "spec": { + "host": "*.default.svc.cluster.local", + "trafficPolicy": { + "tls": { + "mode": "ISTIO_MUTUAL" + } + } + } + } + ] +""" +import jc.utils +from ruamel.yaml import YAML + + +class info(): + version = '1.0' + description = 'YAML file parser' + author = 'Kelly Brazil' + author_email = 'kellyjonbrazil@gmail.com' + details = 'Using the ruamel.yaml library at https://pypi.org/project/ruamel.yaml' + + # compatible options: linux, darwin, cygwin, win32, aix, freebsd + compatible = ['linux', 'darwin', 'cygwin', 'win32', 'aix', 'freebsd'] + + +__version__ = info.version + + +def process(proc_data): + """ + Final processing to conform to the schema. + + Parameters: + + proc_data: (dictionary) raw structured data to process + + Returns: + + List of dictionaries. Each dictionary represents a YAML document: + + [ + { + YAML Document converted to a Dictionary + See https://pypi.org/project/ruamel.yaml for details + } + ] + """ + + # No further processing + return proc_data + + +def parse(data, raw=False, quiet=False): + """ + Main text parsing function + + Parameters: + + data: (string) text data to parse + raw: (boolean) output preprocessed JSON if True + quiet: (boolean) suppress warning messages if True + + Returns: + + List of dictionaries. Raw or processed structured data. + """ + if not quiet: + jc.utils.compatibility(__name__, info.compatible) + + raw_output = [] + yaml = YAML(typ='safe') + + for document in yaml.load_all(data): + raw_output.append(document) + + if raw: + return raw_output + else: + return process(raw_output) diff --git a/setup.py b/setup.py index ce672914..c32b3a18 100755 --- a/setup.py +++ b/setup.py @@ -5,12 +5,14 @@ with open('README.md', 'r') as f: setuptools.setup( name='jc', - version='1.6.1', + version='1.7.1', author='Kelly Brazil', author_email='kellyjonbrazil@gmail.com', - description='This tool serializes the output of popular command line tools to structured JSON output.', + description='This tool serializes the output of popular command line tools and filetypes to structured JSON output.', install_requires=[ - 'ifconfig-parser>=0.0.5' + 'ifconfig-parser>=0.0.5', + 'ruamel.yaml>=0.15.0', + 'xmltodict>=0.12.0' ], license='MIT', long_description=long_description, diff --git a/tests/fixtures/centos-7.7/crontab-u.json b/tests/fixtures/centos-7.7/crontab-u.json new file mode 100644 index 00000000..95cf3b2c --- /dev/null +++ b/tests/fixtures/centos-7.7/crontab-u.json @@ -0,0 +1 @@ +{"variables": [{"name": "MAILTO", "value": "root"}, {"name": "PATH", "value": "/sbin:/bin:/usr/sbin:/usr/bin"}, {"name": "SHELL", "value": "/bin/bash"}], "schedule": [{"minute": ["01"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "user": "root", "command": "run-parts /etc/cron.hourly"}, {"occurrence": "hourly", "user": "root", "command": "/usr/local/bin/backup"}]} diff --git a/tests/fixtures/centos-7.7/crontab-u.out b/tests/fixtures/centos-7.7/crontab-u.out new file mode 100644 index 00000000..c81fa162 --- /dev/null +++ b/tests/fixtures/centos-7.7/crontab-u.out @@ -0,0 +1,6 @@ +# Run the hourly jobs +SHELL=/bin/bash +PATH=/sbin:/bin:/usr/sbin:/usr/bin +MAILTO=root +@hourly root /usr/local/bin/backup +01 * * * * root run-parts /etc/cron.hourly diff --git a/tests/fixtures/centos-7.7/crontab.json b/tests/fixtures/centos-7.7/crontab.json index fc59ebdc..27038a50 100644 --- a/tests/fixtures/centos-7.7/crontab.json +++ b/tests/fixtures/centos-7.7/crontab.json @@ -1 +1 @@ -{"variables": [{"name": "MAILTO", "value": "root"}, {"name": "PATH", "value": "/sbin:/bin:/usr/sbin:/usr/bin"}, {"name": "SHELL", "value": "/bin/bash"}], "schedule": [{"minute": ["*"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/check-apache.sh"}, {"minute": ["5"], "hour": ["10-11", "22"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/mk-new-links.php"}, {"minute": ["30"], "hour": ["4/2"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/create-all-backups.sh"}, {"minute": ["5"], "hour": ["0", "4", "10", "16"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/create-cat-list.sh"}, {"minute": ["5"], "hour": ["0"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/resetContactForm.sh"}, {"minute": ["0", "20", "40"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/freshMint.sh"}, {"minute": ["5", "25", "45"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/greenTaffy.sh"}, {"minute": ["10", "30", "50"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/raspberry.sh"}, {"minute": ["15", "35", "55"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/robinsEgg.sh"}, {"occurrence": "yearly", "command": "/home/maverick/bin/annual-maintenance"}, {"occurrence": "reboot", "command": "/home/cleanup"}, {"occurrence": "monthly", "command": "/home/maverick/bin/tape-backup"}]} +{"variables": [{"name": "MAILTO", "value": "root"}, {"name": "PATH", "value": "/sbin:/bin:/usr/sbin:/usr/bin"}, {"name": "SHELL", "value": "/bin/bash"}], "schedule": [{"minute": ["0"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/usr/bin/wget -O - -q -t 1 http://localhost/cron.php"}, {"minute": ["*"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/check-apache.sh"}, {"minute": ["5"], "hour": ["10-11", "22"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/mk-new-links.php"}, {"minute": ["30"], "hour": ["4/2"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/create-all-backups.sh"}, {"minute": ["5"], "hour": ["0", "4", "10", "16"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/create-cat-list.sh"}, {"minute": ["5"], "hour": ["0"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/devdaily.com/bin/resetContactForm.sh"}, {"minute": ["0", "20", "40"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/freshMint.sh"}, {"minute": ["5", "25", "45"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/greenTaffy.sh"}, {"minute": ["10", "30", "50"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/raspberry.sh"}, {"minute": ["15", "35", "55"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "/var/www/bin/ads/robinsEgg.sh"}, {"occurrence": "yearly", "command": "/home/maverick/bin/annual-maintenance"}, {"occurrence": "reboot", "command": "/home/cleanup"}, {"occurrence": "monthly", "command": "/home/maverick/bin/tape-backup"}]} diff --git a/tests/fixtures/centos-7.7/history.json b/tests/fixtures/centos-7.7/history.json index 1f785288..11ce03d6 100644 --- a/tests/fixtures/centos-7.7/history.json +++ b/tests/fixtures/centos-7.7/history.json @@ -1 +1 @@ -[{"line": "65", "command": "sudo iptables -w -vL -t filter | jc --iptables -p"}, {"line": "66", "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": "67", "command": "sudo iptables -vnL -t filter"}, {"line": "68", "command": "rm iptables.py "}, {"line": "69", "command": "vi iptables.py"}, {"line": "70", "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": "71", "command": "sudo iptables -vL -t filter | jc --iptables -p"}, {"line": "72", "command": "sudo iptables -L -t filter | jc --iptables -p"}, {"line": "73", "command": "sudo iptables -L -t nat | jc --iptables -p"}, {"line": "74", "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": "75", "command": "sudo iptables -vnL -t filter | jc"}, {"line": "76", "command": "sudo iptables -vnL -t filter | jc --iptables"}, {"line": "77", "command": "sudo iptables -vnL -t raw | jc --iptables"}, {"line": "78", "command": "sudo iptables -vnL -t raw | jc --iptables -p"}, {"line": "79", "command": "jobs"}, {"line": "80", "command": "sleep 100 &"}, {"line": "81", "command": "jobs"}, {"line": "82", "command": "sleep 101 &"}, {"line": "83", "command": "jobs"}, {"line": "84", "command": "sleep 102 &"}, {"line": "85", "command": "jobs"}, {"line": "86", "command": "sleep 103 &"}, {"line": "87", "command": "jobs"}, {"line": "88", "command": "iptable"}, {"line": "89", "command": "sudo iptables -L | jc --iptables"}, {"line": "90", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "91", "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": "92", "command": "pip3 install jq"}, {"line": "93", "command": "pip3 install --user jq"}, {"line": "94", "command": "jq"}, {"line": "95", "command": "yum install jq"}, {"line": "96", "command": "sudo yum install jq"}, {"line": "97", "command": "sudo dnf install jq"}, {"line": "98", "command": "curl https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64"}, {"line": "99", "command": "ls"}, {"line": "100", "command": "ls -al"}, {"line": "101", "command": "cd ~"}, {"line": "102", "command": "curl https://github-production-release-asset-2e65be.s3.amazonaws.com/5101141/6387d980-de1f-11e8-8d3e-4455415aa408?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191023T000342Z&X-Amz-Expires=300&X-Amz-Signature=6d4aad2941c281a57ea469d57115f0a3d877fc24998ded52e1c51cbf7b482705&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Djq-linux64&response-content-type=application%2Foctet-stream"}, {"line": "103", "command": "ls"}, {"line": "104", "command": "curl 'https://github-production-release-asset-2e65be.s3.amazonaws.com/5101141/6387d980-de1f-11e8-8d3e-4455415aa408?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191023T000342Z&X-Amz-Expires=300&X-Amz-Signature=6d4aad2941c281a57ea469d57115f0a3d877fc24998ded52e1c51cbf7b482705&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Djq-linux64&response-content-type=application%2Foctet-stream'"}, {"line": "105", "command": "ifconfig"}, {"line": "106", "command": "ls"}, {"line": "107", "command": "chmod jq-linux64 "}, {"line": "108", "command": "chmod +x jq-linux64 "}, {"line": "109", "command": "./jq-linux64 "}, {"line": "110", "command": "mv jq-linux64 jq"}, {"line": "111", "command": "sudo mv jq /usr/local/bin/"}, {"line": "112", "command": "jq"}, {"line": "113", "command": "iptables -L | jc --iptables | jq ."}, {"line": "114", "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": "115", "command": "sudo iptables -L "}, {"line": "116", "command": "sudo iptables -vL "}, {"line": "117", "command": "sudo iptables -vL | jc --iptables | jq ."}, {"line": "118", "command": "df | jc --df -p"}, {"line": "119", "command": "cd ~"}, {"line": "120", "command": "pip3 uninstall jc"}, {"line": "121", "command": "cd git/"}, {"line": "122", "command": "ls"}, {"line": "123", "command": "rm -rf jc/"}, {"line": "124", "command": "history | grep clone"}, {"line": "125", "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": "126", "command": "ls"}, {"line": "127", "command": "cd jc/"}, {"line": "128", "command": "./build-package.sh "}, {"line": "129", "command": "./pypi-upload.sh "}, {"line": "130", "command": "cd .."}, {"line": "131", "command": "ls"}, {"line": "132", "command": "pip3 uninstall jc"}, {"line": "133", "command": "rm -rf jc/"}, {"line": "134", "command": "pip3 install --user --upgrade jc"}, {"line": "135", "command": "iptables -L | jc --iptables | jq"}, {"line": "136", "command": "sudo iptables -L | jc --iptables | jq"}, {"line": "137", "command": "mount | jc --mount -p"}, {"line": "138", "command": "uname -a | jc --uname"}, {"line": "139", "command": "uname -a | jc --uname -p"}, {"line": "140", "command": "df | jc --df -p"}, {"line": "141", "command": "free | jc --free -p"}, {"line": "142", "command": "lsblk | jc --lsblk -p"}, {"line": "143", "command": "ls | jc"}, {"line": "144", "command": "env | jc --env -p"}, {"line": "145", "command": "ls | jc"}, {"line": "146", "command": "route | jc --route -p"}, {"line": "147", "command": "iptables -L | jc --iptables | jq ."}, {"line": "148", "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": "149", "command": "ls"}, {"line": "150", "command": "pip3 uninstall jc"}, {"line": "151", "command": "history | grep clone"}, {"line": "152", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "153", "command": "cd jc/"}, {"line": "154", "command": "pip3 install --user --upgrade -e ."}, {"line": "155", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "156", "command": "sudo iptables -L | jc --iptables"}, {"line": "157", "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": "158", "command": "pip3 list"}, {"line": "159", "command": "cd jc"}, {"line": "160", "command": "ls"}, {"line": "161", "command": "vi jc.py "}, {"line": "162", "command": "jc"}, {"line": "163", "command": "ls | jc"}, {"line": "164", "command": "vi jc.py "}, {"line": "165", "command": "jc"}, {"line": "166", "command": "ls | jc"}, {"line": "167", "command": "cat"}, {"line": "168", "command": "jc"}, {"line": "169", "command": "vi jc.py "}, {"line": "170", "command": "jc"}, {"line": "171", "command": "ls | jc"}, {"line": "172", "command": "vi jc.py "}, {"line": "173", "command": "jc"}, {"line": "174", "command": "vi jc.py "}, {"line": "175", "command": "jc"}, {"line": "176", "command": "ls | jc"}, {"line": "177", "command": "vi jc.py "}, {"line": "178", "command": "jc"}, {"line": "179", "command": "ls | jc"}, {"line": "180", "command": "ls | jc --ls"}, {"line": "181", "command": "jc << ls -l"}, {"line": "182", "command": "jc < ls -l"}, {"line": "183", "command": "jc < ls / -l"}, {"line": "184", "command": "jc < ls -l /"}, {"line": "185", "command": "jc <<< ls -l /"}, {"line": "186", "command": "jc --ls <<< ls -l /"}, {"line": "187", "command": "jc --ls -p <<< ls -l /"}, {"line": "188", "command": "jc --ls -p <<< 'ls -a /'"}, {"line": "189", "command": "cat jc.py "}, {"line": "190", "command": "ls"}, {"line": "191", "command": "rm jc.py "}, {"line": "192", "command": "vi jc.py"}, {"line": "193", "command": "jc"}, {"line": "194", "command": "rm jc.py "}, {"line": "195", "command": "vi jc.py"}, {"line": "196", "command": "jc"}, {"line": "197", "command": "jc --ls"}, {"line": "198", "command": "ls | jc --ls"}, {"line": "199", "command": "ls -al | jc --ls"}, {"line": "200", "command": "ls -al | jc --ls -p"}, {"line": "201", "command": "ls -al | jc --p"}, {"line": "202", "command": "jc"}, {"line": "203", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "204", "command": "mount | jc --mount -p"}, {"line": "205", "command": "jc"}, {"line": "206", "command": "jc --mount"}, {"line": "207", "command": "ps | jc --hello"}, {"line": "208", "command": "jc"}, {"line": "209", "command": "jq"}, {"line": "210", "command": "jq --help"}, {"line": "211", "command": "jc"}, {"line": "212", "command": "ps | jc -p"}, {"line": "213", "command": "ps | jc -p --ps"}, {"line": "214", "command": "jc -p --ps"}, {"line": "215", "command": "ps -ef | jc -p --ps | jq ."}, {"line": "216", "command": "jc"}, {"line": "217", "command": "df | jc --df"}, {"line": "218", "command": "env | jc --env"}, {"line": "219", "command": "free | jc --free"}, {"line": "220", "command": "ifconfig | jc --ifconfig"}, {"line": "221", "command": "jc"}, {"line": "222", "command": "iptables -L | jc --iptables"}, {"line": "223", "command": "sudo iptables -L | jc --iptables"}, {"line": "224", "command": "jc"}, {"line": "225", "command": "ls -l | jc --ls"}, {"line": "226", "command": "lsblk | jc --lsblk"}, {"line": "227", "command": "mount | jc --mount"}, {"line": "228", "command": "jc"}, {"line": "229", "command": "netstat -l | jc --netstat"}, {"line": "230", "command": "ps -ef | jc --ps"}, {"line": "231", "command": "jc"}, {"line": "232", "command": "route | jc --route"}, {"line": "233", "command": "uname -a | jc --uname"}, {"line": "234", "command": "cd parsers/"}, {"line": "235", "command": "rm iptables.py "}, {"line": "236", "command": "vi iptables.py"}, {"line": "237", "command": "sudo iptables -L | jc --iptables"}, {"line": "238", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "239", "command": "lsof"}, {"line": "240", "command": "journalctl "}, {"line": "241", "command": "python3"}, {"line": "242", "command": "ls"}, {"line": "243", "command": "vi jobs.py"}, {"line": "244", "command": "cd .."}, {"line": "245", "command": "ls"}, {"line": "246", "command": "rm jc.py "}, {"line": "247", "command": "vi jc.py"}, {"line": "248", "command": "sleep 500 &"}, {"line": "249", "command": "sleep 501 &"}, {"line": "250", "command": "sleep 502 &"}, {"line": "251", "command": "sleep 503 &"}, {"line": "252", "command": "jobs"}, {"line": "253", "command": "jobs | jc --jobs"}, {"line": "254", "command": "jobs -l | jc --jobs"}, {"line": "255", "command": "jobs -l"}, {"line": "256", "command": "python3"}, {"line": "257", "command": "ls"}, {"line": "258", "command": "cd parsers/"}, {"line": "259", "command": "ls"}, {"line": "260", "command": "rm jobs.py "}, {"line": "261", "command": "vi jobs.py"}, {"line": "262", "command": "jobs | jc --jobs"}, {"line": "263", "command": "jobs"}, {"line": "264", "command": "rm jobs"}, {"line": "265", "command": "rm jobs.py "}, {"line": "266", "command": "vi jobs"}, {"line": "267", "command": "vi jobs.py"}, {"line": "268", "command": "jobs | jc --jobs -p"}, {"line": "269", "command": "jobs -l | jc --jobs -p"}, {"line": "270", "command": "jobs"}, {"line": "271", "command": "sleep 500 &"}, {"line": "272", "command": "sleep 501 &"}, {"line": "273", "command": "sleep 502 &"}, {"line": "274", "command": "sleep 503 &"}, {"line": "275", "command": "jobs -l | jc --jobs -p"}, {"line": "276", "command": "jobs | jc --jobs -p"}, {"line": "277", "command": "rm jobs.py "}, {"line": "278", "command": "vi jobs.py"}, {"line": "279", "command": "jobs | jc --jobs -p"}, {"line": "280", "command": "jobs -l | jc --jobs -p"}, {"line": "281", "command": "jobs"}, {"line": "282", "command": "jobs -l"}, {"line": "283", "command": "rm jobs.py "}, {"line": "284", "command": "vi jobs.py"}, {"line": "285", "command": "jobs -l | jc --jobs -p"}, {"line": "286", "command": "rm jobs.py "}, {"line": "287", "command": "vi jobs.py"}, {"line": "288", "command": "sleep 500 &"}, {"line": "289", "command": "sleep 501 &"}, {"line": "290", "command": "sleep 502 &"}, {"line": "291", "command": "sleep 503 &"}, {"line": "292", "command": "sleep 504 &"}, {"line": "293", "command": "jobs"}, {"line": "294", "command": "jobs -l | jc --jobs -p"}, {"line": "295", "command": "rm jobs.py "}, {"line": "296", "command": "vi jobs.py"}, {"line": "297", "command": "sleep 1000 &"}, {"line": "298", "command": "sleep 1001 &"}, {"line": "299", "command": "sleep 1002 &"}, {"line": "300", "command": "sleep 1003 &"}, {"line": "301", "command": "sleep 1004 &"}, {"line": "302", "command": "jobs | jc --jobs -p"}, {"line": "303", "command": "jobs -l | jc --jobs -p"}, {"line": "304", "command": "python3"}, {"line": "305", "command": "rm jobs.py "}, {"line": "306", "command": "vi jobs.py"}, {"line": "307", "command": "jobs | jc --jobs -p"}, {"line": "308", "command": "rm jobs.py "}, {"line": "309", "command": "vi jobs.py"}, {"line": "310", "command": "jobs | jc --jobs -p"}, {"line": "311", "command": "rm jobs.py "}, {"line": "312", "command": "vi jobs.py"}, {"line": "313", "command": "jobs | jc --jobs -p"}, {"line": "314", "command": "rm jobs.py "}, {"line": "315", "command": "vi jobs.py"}, {"line": "316", "command": "jobs | jc --jobs -p"}, {"line": "317", "command": "jobs -l | jc --jobs -p"}, {"line": "318", "command": "jobs | jc --jobs -p"}, {"line": "319", "command": "rm jobs.py "}, {"line": "320", "command": "vi jobs.py"}, {"line": "321", "command": "jobs | jc --jobs -p"}, {"line": "322", "command": "\"\"\"jc - JSON CLI output utility jobs Parser"}, {"line": "323", "command": "Usage:"}, {"line": "324", "command": "specify --jobs as the first argument if the piped input is coming from jobs"}, {"line": "325", "command": "Examples:"}, {"line": "326", "command": "\"\"\""}, {"line": "327", "command": "import string"}, {"line": "328", "command": "def parse(data):"}, {"line": "329", "command": "output = []"}, {"line": "330", "command": "linedata = data.splitlines()"}, {"line": "331", "command": "# Clear any blank lines"}, {"line": "332", "command": "cleandata = list(filter(None, linedata))"}, {"line": "333", "command": "if cleandata:; for entry in cleandata:; output_line = {}"}, {"line": "334", "command": "job_number = ''"}, {"line": "335", "command": "pid = ''"}, {"line": "336", "command": "job_history = ''"}, {"line": "337", "command": "parsed_line = entry.split(maxsplit=2)"}, {"line": "338", "command": "print(parsed_line)"}, {"line": "339", "command": "# check if -l was used"}, {"line": "340", "command": "if parsed_line[1][0] in string.digits:; pid = parsed_line.pop(1)"}, {"line": "341", "command": "print(parsed_line)"}, {"line": "342", "command": "# check for + or - in first field"}, {"line": "343", "command": "if parsed_line[0].find('+') != -1:"}, {"line": "344", "command": "job_history = 'current'"}, {"line": "345", "command": "job_number = parsed_line[0].rstrip('+')"}, {"line": "346", "command": "if pid:; remainder = parsed_line[1].split(maxsplit=1)"}, {"line": "347", "command": "else:"}, {"line": "348", "command": "remainder = list(parsed_line[1])"}, {"line": "349", "command": "remainder.insert(0, job_number)"}, {"line": "350", "command": "parsed_line = remainder"}, {"line": "351", "command": "if parsed_line[0].find('-') != -1:"}, {"line": "352", "command": "job_history = 'previous'"}, {"line": "353", "command": "job_number = parsed_line[0].rstrip('-')"}, {"line": "354", "command": "if pid:; remainder = parsed_line[1].split(maxsplit=1)"}, {"line": "355", "command": "else:"}, {"line": "356", "command": "remainder = list(parsed_line[1])"}, {"line": "357", "command": "remainder = parsed_line[1].split(maxsplit=1)"}, {"line": "358", "command": "remainder.insert(0, job_number)"}, {"line": "359", "command": "parsed_line = remainder"}, {"line": "360", "command": "# clean up first field"}, {"line": "361", "command": "parsed_line[0] = parsed_line[0].lstrip('[').rstrip(']')"}, {"line": "362", "command": "print(parsed_line)"}, {"line": "363", "command": "# create list of dictionaries"}, {"line": "364", "command": "# output_line['job_number'] = int(parsed_line[0])"}, {"line": "365", "command": "# if pid:"}, {"line": "366", "command": "# output_line['pid'] = int(pid)"}, {"line": "367", "command": "# if job_history:"}, {"line": "368", "command": "# output_line['history'] = job_history"}, {"line": "369", "command": "# output_line['status'] = parsed_line[1]"}, {"line": "370", "command": "# output_line['command'] = parsed_line[2]"}, {"line": "371", "command": "# output.append(output_line)"}, {"line": "372", "command": "# return output"}, {"line": "373", "command": "rm jobs.py "}, {"line": "374", "command": "vi jobs.py"}, {"line": "375", "command": "jobs | jc --jobs -p"}, {"line": "376", "command": "jobs"}, {"line": "377", "command": "sleep"}, {"line": "378", "command": "sleep 1000 &"}, {"line": "379", "command": "sleep 1001 &"}, {"line": "380", "command": "sleep 1002 &"}, {"line": "381", "command": "sleep 1003 &"}, {"line": "382", "command": "sleep 1004 &"}, {"line": "383", "command": "jobs | jc --jobs -p"}, {"line": "384", "command": "jobs -l | jc --jobs -p"}, {"line": "385", "command": "rm jobs.py "}, {"line": "386", "command": "vi jobs.py"}, {"line": "387", "command": "jobs -l | jc --jobs -p"}, {"line": "388", "command": "jobs | jc --jobs -p"}, {"line": "389", "command": "rm jobs.py "}, {"line": "390", "command": "vi jobs.py"}, {"line": "391", "command": "jobs | jc --jobs -p"}, {"line": "392", "command": "jobs -l | jc --jobs -p"}, {"line": "393", "command": "jobs"}, {"line": "394", "command": "rm jobs.py "}, {"line": "395", "command": "vi jobs.py"}, {"line": "396", "command": "sleep 10000 &"}, {"line": "397", "command": "sleep 10001 &"}, {"line": "398", "command": "sleep 10002 &"}, {"line": "399", "command": "sleep 10003 &"}, {"line": "400", "command": "sleep 10004 &"}, {"line": "401", "command": "jobs -l | jc --jobs -p"}, {"line": "402", "command": "jobs | jc --jobs -p"}, {"line": "403", "command": "rm jobs.py "}, {"line": "404", "command": "vi jobs.py"}, {"line": "405", "command": "jobs | jc --jobs -p"}, {"line": "406", "command": "jobs -l| jc --jobs -p"}, {"line": "407", "command": "rm jobs.py "}, {"line": "408", "command": "vi jobs.py"}, {"line": "409", "command": "jobs -l| jc --jobs -p"}, {"line": "410", "command": "jobs | jc --jobs -p"}, {"line": "411", "command": "rm jobs.py "}, {"line": "412", "command": "vi jobs.py"}, {"line": "413", "command": "jobs | jc --jobs -p"}, {"line": "414", "command": "jobs -l | jc --jobs -p"}, {"line": "415", "command": "rm jobs.py "}, {"line": "416", "command": "vi jobs.py"}, {"line": "417", "command": "jobs -l | jc --jobs -p"}, {"line": "418", "command": "jobs| jc --jobs -p"}, {"line": "419", "command": "jc"}, {"line": "420", "command": "lsof"}, {"line": "421", "command": "yum install lsof"}, {"line": "422", "command": "sudo yum install lsof"}, {"line": "423", "command": "lsof"}, {"line": "424", "command": "vi lsof.py"}, {"line": "425", "command": "cd .."}, {"line": "426", "command": "ls"}, {"line": "427", "command": "rm jc.py "}, {"line": "428", "command": "vi jc.py"}, {"line": "429", "command": "lsof | jc --lsof"}, {"line": "430", "command": "cd parsers/"}, {"line": "431", "command": "rm lsof.py "}, {"line": "432", "command": "vi lsof.py"}, {"line": "433", "command": "lsof | jc --lsof -p"}, {"line": "434", "command": "rm lsof.py "}, {"line": "435", "command": "vi lsof.py"}, {"line": "436", "command": "lsof | jc --lsof -p"}, {"line": "437", "command": "rm lsof.py "}, {"line": "438", "command": "vi lsof.py"}, {"line": "439", "command": "lsof | jc --lsof -p"}, {"line": "440", "command": "rm lsof.py "}, {"line": "441", "command": "vi lsof.py"}, {"line": "442", "command": "lsof | jc --lsof -p"}, {"line": "443", "command": "lsof | head"}, {"line": "444", "command": "rm lsof.py "}, {"line": "445", "command": "vi lsof.py"}, {"line": "446", "command": "lsof | jc --lsof "}, {"line": "447", "command": "rm lsof.py "}, {"line": "448", "command": "vi lsof.py"}, {"line": "449", "command": "lsof | jc --lsof "}, {"line": "450", "command": "rm lsof.py "}, {"line": "451", "command": "vi lsof.py"}, {"line": "452", "command": "lsof | jc --lsof "}, {"line": "453", "command": "rm lsof.py "}, {"line": "454", "command": "vi lsof.py"}, {"line": "455", "command": "lsof | jc --lsof "}, {"line": "456", "command": "rm lsof.py "}, {"line": "457", "command": "vi lsof.py"}, {"line": "458", "command": "lsof | jc --lsof "}, {"line": "459", "command": "rm lsof.py "}, {"line": "460", "command": "vi lsof.py"}, {"line": "461", "command": "lsof | jc --lsof "}, {"line": "462", "command": "rm lsof.py "}, {"line": "463", "command": "vi lsof.py"}, {"line": "464", "command": "lsof | jc --lsof "}, {"line": "465", "command": "rm lsof.py "}, {"line": "466", "command": "vi lsof.py"}, {"line": "467", "command": "lsof | jc --lsof "}, {"line": "468", "command": "rm lsof.py "}, {"line": "469", "command": "vi lsof.py"}, {"line": "470", "command": "lsof | jc --lsof "}, {"line": "471", "command": "python3"}, {"line": "472", "command": "rm lsof.py "}, {"line": "473", "command": "vi lsof.py"}, {"line": "474", "command": "lsof | jc --lsof "}, {"line": "475", "command": "lsof"}, {"line": "476", "command": "lsof | head"}, {"line": "477", "command": "rm lsof.py "}, {"line": "478", "command": "vi lsof.py"}, {"line": "479", "command": "lsof | jc --lsof "}, {"line": "480", "command": "lsof | tail"}, {"line": "481", "command": "rm lsof.py "}, {"line": "482", "command": "vi lsof.py"}, {"line": "483", "command": "lsof | jc --lsof "}, {"line": "484", "command": "rm lsof.py "}, {"line": "485", "command": "vi lsof.py"}, {"line": "486", "command": "lsof | jc --lsof "}, {"line": "487", "command": "rm lsof.py "}, {"line": "488", "command": "vi lsof.py"}, {"line": "489", "command": "lsof | jc --lsof "}, {"line": "490", "command": "rm lsof.py "}, {"line": "491", "command": "vi lsof.py"}, {"line": "492", "command": "lsof | jc --lsof "}, {"line": "493", "command": "rm lsof.py "}, {"line": "494", "command": "vi lsof.py"}, {"line": "495", "command": "lsof | jc --lsof "}, {"line": "496", "command": "~/resizeterm.sh "}, {"line": "497", "command": "rm lsof.py "}, {"line": "498", "command": "vi lsof.py"}, {"line": "499", "command": "lsof | jc --lsof "}, {"line": "500", "command": "rm lsof.py "}, {"line": "501", "command": "vi lsof.py"}, {"line": "502", "command": "lsof | jc --lsof "}, {"line": "503", "command": "rm lsof.py "}, {"line": "504", "command": "vi lsof.py"}, {"line": "505", "command": "lsof | jc --lsof "}, {"line": "506", "command": "rm lsof.py "}, {"line": "507", "command": "vi lsof.py"}, {"line": "508", "command": "lsof | jc --lsof "}, {"line": "509", "command": "rm lsof.py "}, {"line": "510", "command": "vi lsof.py"}, {"line": "511", "command": "lsof | jc --lsof "}, {"line": "512", "command": "sudo lsof | jc --lsof "}, {"line": "513", "command": "lsof"}, {"line": "514", "command": "rm lsof.py "}, {"line": "515", "command": "vi lsof.py"}, {"line": "516", "command": "sudo lsof | jc --lsof "}, {"line": "517", "command": "rm lsof.py "}, {"line": "518", "command": "vi lsof.py"}, {"line": "519", "command": "sudo lsof | jc --lsof -p"}, {"line": "520", "command": "sudo lsof | more"}, {"line": "521", "command": "rm lsof.py "}, {"line": "522", "command": "vi lsof.py"}, {"line": "523", "command": "sudo lsof | jc --lsof -p"}, {"line": "524", "command": "lsof | jc --lsof -p"}, {"line": "525", "command": "lsof | jc --lsof"}, {"line": "526", "command": "lsof | jc --lsof | jq ."}, {"line": "527", "command": "jc"}, {"line": "528", "command": "sudo lsof | jc --lsof -p"}, {"line": "529", "command": "man lsof"}, {"line": "530", "command": "~/resizeterm.sh "}, {"line": "531", "command": "sudo lsof | jc --lsof -p"}, {"line": "532", "command": "python3"}, {"line": "533", "command": "lsmod"}, {"line": "534", "command": "~/resizeterm.sh "}, {"line": "535", "command": "lsmod"}, {"line": "536", "command": "cd ~"}, {"line": "537", "command": "pip3 uninstall jc"}, {"line": "538", "command": "cd git/"}, {"line": "539", "command": "rm -rf jc/"}, {"line": "540", "command": "pip3 install --upgrade --user -e ."}, {"line": "541", "command": "history | grep clone"}, {"line": "542", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "543", "command": "cd jc/"}, {"line": "544", "command": "pip3 install --upgrade --user -e ."}, {"line": "545", "command": "jc"}, {"line": "546", "command": "lsmod | jc --lsmod -p"}, {"line": "547", "command": "cd pypi-upload.sh "}, {"line": "548", "command": "cd jc"}, {"line": "549", "command": "cd parsers/"}, {"line": "550", "command": "ls"}, {"line": "551", "command": "rm lsmod.py "}, {"line": "552", "command": "vi lsmod.py"}, {"line": "553", "command": "lsmod | jc --lsmod -p"}, {"line": "554", "command": "rm lsmod.py "}, {"line": "555", "command": "vi lsmod.py"}, {"line": "556", "command": "lsmod | jc --lsmod -p"}, {"line": "557", "command": "rm lsmod.py "}, {"line": "558", "command": "vi lsmod.py"}, {"line": "559", "command": "lsmod | jc --lsmod -p"}, {"line": "560", "command": "rm lsmod.py "}, {"line": "561", "command": "vi lsmod.py"}, {"line": "562", "command": "lsmod | jc --lsmod -p"}, {"line": "563", "command": "rm lsmod.py "}, {"line": "564", "command": "vi lsmod.py"}, {"line": "565", "command": "lsmod | jc --lsmod -p"}, {"line": "566", "command": "rm lsmod.py "}, {"line": "567", "command": "vi lsmod.py"}, {"line": "568", "command": "lsmod | jc --lsmod -p"}, {"line": "569", "command": "rm lsmod.py "}, {"line": "570", "command": "vi lsmod.py"}, {"line": "571", "command": "lsmod | jc --lsmod -p"}, {"line": "572", "command": "rm lsmod.py "}, {"line": "573", "command": "vi lsmod.py"}, {"line": "574", "command": "lsmod | jc --lsmod -p"}, {"line": "575", "command": "rm lsmod.py "}, {"line": "576", "command": "vi lsmod.py"}, {"line": "577", "command": "lsmod | jc --lsmod -p"}, {"line": "578", "command": "jc"}, {"line": "579", "command": "cd ~"}, {"line": "580", "command": "pip3 uninstall jc"}, {"line": "581", "command": "cd git/"}, {"line": "582", "command": "rm -rf jc/"}, {"line": "583", "command": "history | grep clone"}, {"line": "584", "command": "ls"}, {"line": "585", "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": "586", "command": "cd jc/"}, {"line": "587", "command": "ls"}, {"line": "588", "command": "./build-package.sh "}, {"line": "589", "command": "ls"}, {"line": "590", "command": "./pypi-upload.sh "}, {"line": "591", "command": "cd .."}, {"line": "592", "command": "ls"}, {"line": "593", "command": "pip3 uninstall jc"}, {"line": "594", "command": "rm -rf jc/"}, {"line": "595", "command": "pip3 install --upgrade --user jc"}, {"line": "596", "command": "pip3 list"}, {"line": "597", "command": "jc"}, {"line": "598", "command": "jc -p"}, {"line": "599", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "600", "command": "jc"}, {"line": "601", "command": "lsmod | jc --lsmod -p"}, {"line": "602", "command": "jc"}, {"line": "603", "command": "jobs"}, {"line": "604", "command": "sleep 500 &"}, {"line": "605", "command": "jobs -l | jc --jobs -p"}, {"line": "606", "command": "jobs | jc --jobs -p"}, {"line": "607", "command": "lsof"}, {"line": "608", "command": "cd ~"}, {"line": "609", "command": "pip3 list"}, {"line": "610", "command": "lsof | jc --lsof > testfile"}, {"line": "611", "command": "cat testfile "}, {"line": "612", "command": "iptables -L | jc --iptables > testfile "}, {"line": "613", "command": "sudo iptables -L | jc --iptables > testfile "}, {"line": "614", "command": "cat testfile "}, {"line": "615", "command": "cat testfile | jq ."}, {"line": "616", "command": "w"}, {"line": "617", "command": "w -h"}, {"line": "618", "command": "w --help"}, {"line": "619", "command": "w -f"}, {"line": "620", "command": "w -i"}, {"line": "621", "command": "w -s"}, {"line": "622", "command": "w -o"}, {"line": "623", "command": "date"}, {"line": "624", "command": "ls | jc --ls"}, {"line": "625", "command": "ls | jc --ls | jq '.select(\"filename\" = \"git)'"}, {"line": "626", "command": "ls | jc --ls | jq '.select(.filename=\"git)'"}, {"line": "627", "command": "ls | jc --ls | jq '.select(.filename=\"git\")'"}, {"line": "628", "command": "ls | jc --ls | jq 'select(.filename == \"git\")'"}, {"line": "629", "command": "ls | jc --ls | jq '.[] | select(.filename == \"git\")'"}, {"line": "630", "command": "ls | jc --ls | jq -r '.[] | select(.filename == \"git\")'"}, {"line": "631", "command": "ls | jc --ls | jq -r '.[] | select(.filename == \"git\") | .filename'"}, {"line": "632", "command": "ifconfig | jc --ifconfig -p"}, {"line": "633", "command": "jc -p"}, {"line": "634", "command": "jc"}, {"line": "635", "command": "ls | jc -p"}, {"line": "636", "command": "ip"}, {"line": "637", "command": "ip address"}, {"line": "638", "command": "ip --help"}, {"line": "639", "command": "ip address --help"}, {"line": "640", "command": "ip address -h"}, {"line": "641", "command": "ip -h address"}, {"line": "642", "command": "ip -b address"}, {"line": "643", "command": "ip -iec address"}, {"line": "644", "command": "ip address"}, {"line": "645", "command": "ip --help"}, {"line": "646", "command": "ip -br address"}, {"line": "647", "command": "ip -d address"}, {"line": "648", "command": "ifconfig"}, {"line": "649", "command": "cat"}, {"line": "650", "command": "jc"}, {"line": "651", "command": "jc | cat"}, {"line": "652", "command": "jc > testing"}, {"line": "653", "command": "cat testing "}, {"line": "654", "command": "rm testing "}, {"line": "655", "command": "jc &2 > testing"}, {"line": "656", "command": "cat testing "}, {"line": "657", "command": "ls"}, {"line": "658", "command": "cat testing "}, {"line": "659", "command": "rm testing "}, {"line": "660", "command": "jc 2>&1 | jc --ls"}, {"line": "661", "command": "jc 2>&1 | jc --ls -p"}, {"line": "662", "command": "jc 2>&1 | jc --route -p"}, {"line": "663", "command": "jc 2>&1 | jc --ps -p"}, {"line": "664", "command": "jc 2>&1 | jc --iptables -p"}, {"line": "665", "command": "jc 2>&1 | jc --lsof -p"}, {"line": "666", "command": "jc 2>&1 | jc --ls -p"}, {"line": "667", "command": "jc 2>&1 | jc --env -p"}, {"line": "668", "command": "jc 2>&1 | jc --netstat -p"}, {"line": "669", "command": "jc 2>&1 | jc --uname -p"}, {"line": "670", "command": "jc"}, {"line": "671", "command": "journalctl "}, {"line": "672", "command": "man journalctl"}, {"line": "673", "command": "man journalctl -o=json"}, {"line": "674", "command": "journalctl -o=json"}, {"line": "675", "command": "journalctl -o json"}, {"line": "676", "command": "journalctl -o json >journaljson"}, {"line": "677", "command": "cat journaljson "}, {"line": "678", "command": "dig"}, {"line": "679", "command": "uptime"}, {"line": "680", "command": "uptime --help"}, {"line": "681", "command": "uptime -p"}, {"line": "682", "command": "uptime -s"}, {"line": "683", "command": "uptime "}, {"line": "684", "command": "date"}, {"line": "685", "command": "uptime"}, {"line": "686", "command": "history"}, {"line": "687", "command": "pip3 uninstall jc"}, {"line": "688", "command": "cd git/"}, {"line": "689", "command": "ls"}, {"line": "690", "command": "history | grep clone"}, {"line": "691", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "692", "command": "cd jc"}, {"line": "693", "command": "pip3 install --upgrade --user -e ."}, {"line": "694", "command": "jc"}, {"line": "695", "command": "w | jc --w -p"}, {"line": "696", "command": "history | jc --history"}, {"line": "697", "command": "history"}, {"line": "698", "command": "history | jc --history -p"}, {"line": "699", "command": "history | head"}, {"line": "700", "command": "cd jc/parsers/"}, {"line": "701", "command": "vi history.py "}, {"line": "702", "command": "history | jc --history -p"}, {"line": "703", "command": "vi history.py "}, {"line": "704", "command": "history | jc --history -p"}, {"line": "705", "command": "echo \"hello\""}, {"line": "706", "command": "history | jc --history -p"}, {"line": "707", "command": "cat history.py "}, {"line": "708", "command": "rm history.py "}, {"line": "709", "command": "vi history.py"}, {"line": "710", "command": "history | jc --history -p"}, {"line": "711", "command": "history | jc --history"}, {"line": "712", "command": "history | jc --history -p"}, {"line": "713", "command": "history | jc --history -p | jq .1700"}, {"line": "714", "command": "history | jc --history -p | jq .1709"}, {"line": "715", "command": "history | jc --history | jq .1709"}, {"line": "716", "command": "history | jc --history | jq ."}, {"line": "717", "command": "history | jc --history | jq .\"1713\""}, {"line": "718", "command": "history | jc --history | jq .[1713]"}, {"line": "719", "command": "history | jc --history | jq .[\"1713\"]"}, {"line": "720", "command": "history | jc --history | jq '.1713'"}, {"line": "721", "command": "history | jc --history | jq '.[1713]'"}, {"line": "722", "command": "history | jc --history | jq '.[\"1713\"]'"}, {"line": "723", "command": "rm history.py "}, {"line": "724", "command": "vi history.py"}, {"line": "725", "command": "history | jc --history -p"}, {"line": "726", "command": "history | jc --history -p | jq .n1723"}, {"line": "727", "command": "cd ~"}, {"line": "728", "command": "pip3 uninstall jc"}, {"line": "729", "command": "cd git/"}, {"line": "730", "command": "rm -rf jc/"}, {"line": "731", "command": "history | grep clone"}, {"line": "732", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "733", "command": "cd jc/"}, {"line": "734", "command": "pip3 install --upgrade --user -e ."}, {"line": "735", "command": "jc"}, {"line": "736", "command": "history | jc --history -p"}, {"line": "737", "command": "jc"}, {"line": "738", "command": "w | jc --w -p"}, {"line": "739", "command": "uptime | jc --uptime -p"}, {"line": "740", "command": "ls"}, {"line": "741", "command": "stat build-package.sh "}, {"line": "742", "command": "ls"}, {"line": "743", "command": "stat jc.egg-info/"}, {"line": "744", "command": "stat README.md "}, {"line": "745", "command": "lstat"}, {"line": "746", "command": "cd /proc/"}, {"line": "747", "command": "ls"}, {"line": "748", "command": "cd 1"}, {"line": "749", "command": "ls"}, {"line": "750", "command": "ls -al"}, {"line": "751", "command": "cd attr/"}, {"line": "752", "command": "ls"}, {"line": "753", "command": "ls -al"}, {"line": "754", "command": "cat current "}, {"line": "755", "command": "cat exec "}, {"line": "756", "command": "cat prev "}, {"line": "757", "command": "dig"}, {"line": "758", "command": "sudo yum install dig"}, {"line": "759", "command": "sudo yum install bind-utils"}, {"line": "760", "command": "dig"}, {"line": "761", "command": "dig www.google.com"}, {"line": "762", "command": "dig www.cnn.com"}, {"line": "763", "command": "man dig"}, {"line": "764", "command": "dig www.cnn.com www.google.com"}, {"line": "765", "command": "pip3 list"}, {"line": "766", "command": "cd ~/git/jc/jc/parsers/"}, {"line": "767", "command": "rm history.py "}, {"line": "768", "command": "vi history.py"}, {"line": "769", "command": "history | jc --history"}, {"line": "770", "command": "history | jc --history -p"}, {"line": "771", "command": "ifconfig | jc --ifconfig -p"}, {"line": "772", "command": "rm iptables.py "}, {"line": "773", "command": "vi iptables.py"}, {"line": "774", "command": "iptables -L | jc --iptables -p"}, {"line": "775", "command": "sudo iptables -L | jc --iptables -p"}, {"line": "776", "command": "lsblk | jc --lsblk -p"}, {"line": "777", "command": "rm lsblk.py "}, {"line": "778", "command": "vi lsblk.py"}, {"line": "779", "command": "lsblk | jc --lsblk -p"}, {"line": "780", "command": "rm lsmod.py "}, {"line": "781", "command": "vi lsmod.py"}, {"line": "782", "command": "lsmod"}, {"line": "783", "command": "lsmod | jc --lsmod -p"}, {"line": "784", "command": "rm lsof.py "}, {"line": "785", "command": "vi lsof.py"}, {"line": "786", "command": "lsof | jc --lsof -p"}, {"line": "787", "command": "sudo lsof | jc --lsof -p"}, {"line": "788", "command": "sudo lsof | jc --lsof | jq ."}, {"line": "789", "command": "ps | jc --ps -p"}, {"line": "790", "command": "clear"}, {"line": "791", "command": "rm ps.py "}, {"line": "792", "command": "vi ps.py"}, {"line": "793", "command": "ps | jc --ps -p"}, {"line": "794", "command": "ps axu | jc --ps -p"}, {"line": "795", "command": "rm ps.py "}, {"line": "796", "command": "vi ps.py"}, {"line": "797", "command": "ps | jc --ps -p"}, {"line": "798", "command": "ps axu | jc --ps -p"}, {"line": "799", "command": "ps -ef | jc --ps -p"}, {"line": "800", "command": "ps -ef | jc --ps -p | jq ."}, {"line": "801", "command": "ps axu | jc --ps -p | jq ."}, {"line": "802", "command": "ps -ef | jc --ps -p"}, {"line": "803", "command": "ls"}, {"line": "804", "command": "rm route.py "}, {"line": "805", "command": "vi route.py"}, {"line": "806", "command": "route | jc --route -p"}, {"line": "807", "command": "w | jc --w -p"}, {"line": "808", "command": "rm w.py "}, {"line": "809", "command": "vi w.py"}, {"line": "810", "command": "w | jc --w -p"}, {"line": "811", "command": "rm ls.py "}, {"line": "812", "command": "vi ls.py"}, {"line": "813", "command": "ls -lh | jc --ps -p"}, {"line": "814", "command": "ls | jc --ls -p"}, {"line": "815", "command": "ls -alh | jc --ls -p"}, {"line": "816", "command": "ls -lh | jc --ls -p"}, {"line": "817", "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.bytes|tonumber > 50000000)'"}, {"line": "818", "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.size|tonumber > 50000000)'"}, {"line": "819", "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.size|tonumber > 5000000)'"}, {"line": "820", "command": "$ ls -l /bin | jc --ls -p"}, {"line": "821", "command": "ls -l /bin | jc --ls -p"}, {"line": "822", "command": "python3"}, {"line": "823", "command": "rm jobs.py "}, {"line": "824", "command": "vi jobs.py"}, {"line": "825", "command": "sleep 1000 &"}, {"line": "826", "command": "sleep 1001 &"}, {"line": "827", "command": "sleep 1002 &"}, {"line": "828", "command": "sleep 1003 &"}, {"line": "829", "command": "jobs | jc --jobs -p"}, {"line": "830", "command": "jobs -l | jc --jobs -p"}, {"line": "831", "command": "rm ls.py "}, {"line": "832", "command": "vi ls.py"}, {"line": "833", "command": "ls -al | jc --ls -p"}, {"line": "834", "command": "ls -alh | jc --ls -p"}, {"line": "835", "command": "ls -al /usr/bin | jc --ls -p"}, {"line": "836", "command": "ls /usr/bin | jc --ls -p"}, {"line": "837", "command": "rm netstat.py "}, {"line": "838", "command": "vi netstat.py"}, {"line": "839", "command": "history | grep netstat"}, {"line": "840", "command": "netstat -l | jc --netstat -p"}, {"line": "841", "command": "netstat -lv | jc --netstat -p"}, {"line": "842", "command": "netstat -ln | jc --netstat -p"}, {"line": "843", "command": "sudo netstat -lpn | jc --netstat -p"}, {"line": "844", "command": "sudo systemctl restart"}, {"line": "845", "command": "reboot"}, {"line": "846", "command": "jc"}, {"line": "847", "command": "w | jc --w -p"}, {"line": "848", "command": "uptime | jc --uptime -p"}, {"line": "849", "command": "uptime"}, {"line": "850", "command": "cd git/jc/jc/parsers/"}, {"line": "851", "command": "rm uptime.py "}, {"line": "852", "command": "vi uptime.py"}, {"line": "853", "command": "uptime | jc --uptime -p"}, {"line": "854", "command": "~/resizeterm.sh "}, {"line": "855", "command": "rm uptime.py "}, {"line": "856", "command": "vi uptime.py"}, {"line": "857", "command": "uptime | jc --uptime -p"}, {"line": "858", "command": "w | jc --w -p"}, {"line": "859", "command": "uptime | jc --uptime -p"}, {"line": "860", "command": "cd .."}, {"line": "861", "command": "ls"}, {"line": "862", "command": "rm jc.py "}, {"line": "863", "command": "vi jc.py"}, {"line": "864", "command": "lsof | jc --lsof -p"}, {"line": "865", "command": "cat jc.py "}, {"line": "866", "command": "uptime | jc --uptime -p"}, {"line": "867", "command": "vi jc.py "}, {"line": "868", "command": "rm jc.py "}, {"line": "869", "command": "vi jc.py"}, {"line": "870", "command": "jc"}, {"line": "871", "command": "lsof | jc --lsof -p"}, {"line": "872", "command": "uptime | jc --uptime -p"}, {"line": "873", "command": "lsof | jc --lsof -p"}, {"line": "874", "command": "sudo lsof | jc --lsof -p"}, {"line": "875", "command": "uptime | jc --uptime -p"}, {"line": "876", "command": "ls"}, {"line": "877", "command": "cd .."}, {"line": "878", "command": "ls"}, {"line": "879", "command": "pip3 uninstall jc"}, {"line": "880", "command": "rm -rf jc/"}, {"line": "881", "command": "history | grep clone"}, {"line": "882", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "883", "command": "cd jc/"}, {"line": "884", "command": "pip3 install --upgrade --user -e ."}, {"line": "885", "command": "jc"}, {"line": "886", "command": "uptime | jc --uptime -p"}, {"line": "887", "command": "uptime | jc --uptime"}, {"line": "888", "command": "lsof | jc --lsof -p"}, {"line": "889", "command": "ls"}, {"line": "890", "command": "cat changelog.txt "}, {"line": "891", "command": "env | jc -env -p"}, {"line": "892", "command": "env | jc --env -p"}, {"line": "893", "command": "history | jc --history -p"}, {"line": "894", "command": "history | jc --history | jq 'select(\"vi\")'"}, {"line": "895", "command": "history | jc --history | jq 'select(.value=\"ls\")'"}, {"line": "896", "command": "history | jc --history | jq 'select(.value==\"ls\")'"}, {"line": "897", "command": "history | jc --history | jq 'select(.value==\"jc\")'"}, {"line": "898", "command": "history | jc --history | jq 'select(.value == jc)'"}, {"line": "899", "command": "history | jc --history -p"}, {"line": "900", "command": "uptime | jc --uptime -p"}, {"line": "901", "command": "pip3 list"}, {"line": "902", "command": "pip3 install --upgrade pip"}, {"line": "903", "command": "pip3 install --upgrade --user pip"}, {"line": "904", "command": "pip3 list"}, {"line": "905", "command": "jc"}, {"line": "906", "command": "df | jc --df -p"}, {"line": "907", "command": "jc"}, {"line": "908", "command": "env | jc --env -p"}, {"line": "909", "command": "env | jc --env"}, {"line": "910", "command": "env | jc --env | jq '. paths'"}, {"line": "911", "command": "env | jc --env | jq 'paths()'"}, {"line": "912", "command": "env | jc --env | jq '[paths(\"ls\")]'"}, {"line": "913", "command": "env"}, {"line": "914", "command": "env | jc --env | jq '[paths(\"kbrazil\")]'"}, {"line": "915", "command": "uptime | jc --uptime -p"}, {"line": "916", "command": "jc"}, {"line": "917", "command": "free | jc --free -p"}, {"line": "918", "command": "history | jc --history"}, {"line": "919", "command": "jc"}, {"line": "920", "command": "ifconfig | jc --ifconfig -p"}, {"line": "921", "command": "jc"}, {"line": "922", "command": "sudo iptables -vnL | jc --iptables -p"}, {"line": "923", "command": "jc"}, {"line": "924", "command": "sudo iptables -vnL | jc --iptables -p"}, {"line": "925", "command": "ls"}, {"line": "926", "command": "jc"}, {"line": "927", "command": "jobs | jc --jobs -p"}, {"line": "928", "command": "jobs -p| jc --jobs -p"}, {"line": "929", "command": "jobs -a| jc --jobs -p"}, {"line": "930", "command": "jobs -l| jc --jobs -p"}, {"line": "931", "command": "sleep 100 &"}, {"line": "932", "command": "jobs -l| jc --jobs -p"}, {"line": "933", "command": "jc"}, {"line": "934", "command": "ls -alh | jc --ls -p"}, {"line": "935", "command": "jc"}, {"line": "936", "command": "lsblk | jc --lsblk -p"}, {"line": "937", "command": "uptime | jc --uptime -p"}, {"line": "938", "command": "jc"}, {"line": "939", "command": "lsmod | jc --lsmod -p"}, {"line": "940", "command": "jc"}, {"line": "941", "command": "lsof | jc --lsof -p"}, {"line": "942", "command": "sudo lsof | jc --lsof -p"}, {"line": "943", "command": "uptime | jc --uptime -p"}, {"line": "944", "command": "uptime | jc --uptime | jq ."}, {"line": "945", "command": "uptime"}, {"line": "946", "command": "uptime | jc --uptime | jq ."}, {"line": "947", "command": "uptime | jc --uptime -p"}, {"line": "948", "command": "cd jc/parsers/"}, {"line": "949", "command": "rm uptime.py "}, {"line": "950", "command": "vi uptime.py"}, {"line": "951", "command": "uptime | jc --uptime -p"}, {"line": "952", "command": "rm uptime.py "}, {"line": "953", "command": "vi uptime.py"}, {"line": "954", "command": "rm uptime.py "}, {"line": "955", "command": "vi uptime.py"}, {"line": "956", "command": "uptime | jc --uptime -p"}, {"line": "957", "command": "uptime"}, {"line": "958", "command": "rm uptime.py "}, {"line": "959", "command": "vi uptime.py"}, {"line": "960", "command": "uptime | jc --uptime -p"}, {"line": "961", "command": "rm uptime.py "}, {"line": "962", "command": "vi uptime.py"}, {"line": "963", "command": "uptime | jc --uptime -p"}, {"line": "964", "command": "rm uptime.py "}, {"line": "965", "command": "vi uptime.py"}, {"line": "966", "command": "uptime | jc --uptime -p"}, {"line": "967", "command": "rm uptime.py "}, {"line": "968", "command": "vi uptime.py"}, {"line": "969", "command": "uptime | jc --uptime -p"}, {"line": "970", "command": "reboot"}, {"line": "971", "command": "uptime"}, {"line": "972", "command": "uptime | jc --uptime -p"}, {"line": "973", "command": "python3"}, {"line": "974", "command": "uptime | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": "975", "command": "echo '22:19 up 54 days, 1 min, 4 users, load averages: 2.08 2.06 2.27' | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": "976", "command": "~/resizeterm.sh "}, {"line": "977", "command": "echo '22:19 up 54 days, 1 min, 4 users, load averages: 2.08 2.06 2.27' | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": "978", "command": "uptime | jc --uptime -p"}, {"line": "979", "command": "cd git/jc/jc/parsers/"}, {"line": "980", "command": "rm uptime.py "}, {"line": "981", "command": "vi uptime.py"}, {"line": "982", "command": "uptime | jc --uptime -p"}, {"line": "983", "command": "rm uptime.py "}, {"line": "984", "command": "vi uptime.py"}, {"line": "985", "command": "uptime | jc --uptime -p"}, {"line": "986", "command": "python3"}, {"line": "987", "command": "uptime | jc --uptime -p"}, {"line": "988", "command": "rm uptime.py "}, {"line": "989", "command": "vi uptime.py"}, {"line": "990", "command": "uptime | jc --uptime -p"}, {"line": "991", "command": "rm uptime.py "}, {"line": "992", "command": "vi uptime.py"}, {"line": "993", "command": "uptime | jc --uptime -p"}, {"line": "994", "command": "reboot"}, {"line": "995", "command": "ls"}, {"line": "996", "command": "w"}, {"line": "997", "command": "mkdir testfiles"}, {"line": "998", "command": "ls"}, {"line": "999", "command": "cat testfile"}, {"line": "1000", "command": "rm testfile"}, {"line": "1001", "command": "ls"}, {"line": "1002", "command": "cd testfiles/"}, {"line": "1003", "command": "vi tests.sh"}, {"line": "1004", "command": "chmod +x tests.sh "}, {"line": "1005", "command": "ls"}, {"line": "1006", "command": "./tests.sh "}, {"line": "1007", "command": "ls"}, {"line": "1008", "command": "cat jobs.out "}, {"line": "1009", "command": "cat w.out "}, {"line": "1010", "command": "cat uname-a.out "}, {"line": "1011", "command": "jc"}, {"line": "1012", "command": "rm tests.sh "}, {"line": "1013", "command": "vi tests.sh"}, {"line": "1014", "command": "chmod +x tests.sh "}, {"line": "1015", "command": "./tests.sh "}, {"line": "1016", "command": "uptime "}, {"line": "1017", "command": "rm tests.sh "}, {"line": "1018", "command": "vi tests.sh"}, {"line": "1019", "command": "chmod +x tests.sh "}, {"line": "1020", "command": "./tests.sh "}, {"line": "1021", "command": "ls"}, {"line": "1022", "command": "cat uptime.out "}, {"line": "1023", "command": "cat uptime.out | jc --uptime -p"}, {"line": "1024", "command": "route -n > route-n.out"}, {"line": "1025", "command": "cat route-n.out "}, {"line": "1026", "command": "route -vn"}, {"line": "1027", "command": "rm route-n.out "}, {"line": "1028", "command": "ls"}, {"line": "1029", "command": "cat iptables-filter-nv.out "}, {"line": "1030", "command": "cat iptables-filter-nv.out | jc --iptables -p"}, {"line": "1031", "command": "ls"}, {"line": "1032", "command": "cat iptables-mangle.out "}, {"line": "1033", "command": "rm tests.sh "}, {"line": "1034", "command": "vi tests.sh"}, {"line": "1035", "command": "chmod +x tests.sh "}, {"line": "1036", "command": "./tests.sh "}, {"line": "1037", "command": "ls"}, {"line": "1038", "command": "ls -al"}, {"line": "1039", "command": "cat history.out "}, {"line": "1040", "command": "history"}, {"line": "1041", "command": "history > kbhistory.out"}, {"line": "1042", "command": "cat kbhistory.out "}, {"line": "1043", "command": "rm kbhistory.out "}, {"line": "1044", "command": "ls"}, {"line": "1045", "command": "ls -al"}, {"line": "1046", "command": "rm tests.sh "}, {"line": "1047", "command": "vi tests.sh"}, {"line": "1048", "command": "chmod +x tests.sh "}, {"line": "1049", "command": "./tests.sh "}, {"line": "1050", "command": "ls -al"}, {"line": "1051", "command": "vi iptables-filter.out "}, {"line": "1052", "command": "uname -a"}, {"line": "1053", "command": "cd /"}, {"line": "1054", "command": "ls"}, {"line": "1055", "command": "cd etc/"}, {"line": "1056", "command": "ls"}, {"line": "1057", "command": "cat environment "}, {"line": "1058", "command": "cat centos-release"}, {"line": "1059", "command": "lsb_release -a"}, {"line": "1060", "command": "ifconfig"}, {"line": "1061", "command": "cd ~"}, {"line": "1062", "command": "ls"}, {"line": "1063", "command": "cd testfiles/"}, {"line": "1064", "command": "history > history.out "}] +[{"line": 65, "command": "sudo iptables -w -vL -t filter | jc --iptables -p"}, {"line": 66, "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": 67, "command": "sudo iptables -vnL -t filter"}, {"line": 68, "command": "rm iptables.py "}, {"line": 69, "command": "vi iptables.py"}, {"line": 70, "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": 71, "command": "sudo iptables -vL -t filter | jc --iptables -p"}, {"line": 72, "command": "sudo iptables -L -t filter | jc --iptables -p"}, {"line": 73, "command": "sudo iptables -L -t nat | jc --iptables -p"}, {"line": 74, "command": "sudo iptables -vnL -t filter | jc --iptables -p"}, {"line": 75, "command": "sudo iptables -vnL -t filter | jc"}, {"line": 76, "command": "sudo iptables -vnL -t filter | jc --iptables"}, {"line": 77, "command": "sudo iptables -vnL -t raw | jc --iptables"}, {"line": 78, "command": "sudo iptables -vnL -t raw | jc --iptables -p"}, {"line": 79, "command": "jobs"}, {"line": 80, "command": "sleep 100 &"}, {"line": 81, "command": "jobs"}, {"line": 82, "command": "sleep 101 &"}, {"line": 83, "command": "jobs"}, {"line": 84, "command": "sleep 102 &"}, {"line": 85, "command": "jobs"}, {"line": 86, "command": "sleep 103 &"}, {"line": 87, "command": "jobs"}, {"line": 88, "command": "iptable"}, {"line": 89, "command": "sudo iptables -L | jc --iptables"}, {"line": 90, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 91, "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": 92, "command": "pip3 install jq"}, {"line": 93, "command": "pip3 install --user jq"}, {"line": 94, "command": "jq"}, {"line": 95, "command": "yum install jq"}, {"line": 96, "command": "sudo yum install jq"}, {"line": 97, "command": "sudo dnf install jq"}, {"line": 98, "command": "curl https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64"}, {"line": 99, "command": "ls"}, {"line": 100, "command": "ls -al"}, {"line": 101, "command": "cd ~"}, {"line": 102, "command": "curl https://github-production-release-asset-2e65be.s3.amazonaws.com/5101141/6387d980-de1f-11e8-8d3e-4455415aa408?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191023T000342Z&X-Amz-Expires=300&X-Amz-Signature=6d4aad2941c281a57ea469d57115f0a3d877fc24998ded52e1c51cbf7b482705&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Djq-linux64&response-content-type=application%2Foctet-stream"}, {"line": 103, "command": "ls"}, {"line": 104, "command": "curl 'https://github-production-release-asset-2e65be.s3.amazonaws.com/5101141/6387d980-de1f-11e8-8d3e-4455415aa408?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191023%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191023T000342Z&X-Amz-Expires=300&X-Amz-Signature=6d4aad2941c281a57ea469d57115f0a3d877fc24998ded52e1c51cbf7b482705&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Djq-linux64&response-content-type=application%2Foctet-stream'"}, {"line": 105, "command": "ifconfig"}, {"line": 106, "command": "ls"}, {"line": 107, "command": "chmod jq-linux64 "}, {"line": 108, "command": "chmod +x jq-linux64 "}, {"line": 109, "command": "./jq-linux64 "}, {"line": 110, "command": "mv jq-linux64 jq"}, {"line": 111, "command": "sudo mv jq /usr/local/bin/"}, {"line": 112, "command": "jq"}, {"line": 113, "command": "iptables -L | jc --iptables | jq ."}, {"line": 114, "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": 115, "command": "sudo iptables -L "}, {"line": 116, "command": "sudo iptables -vL "}, {"line": 117, "command": "sudo iptables -vL | jc --iptables | jq ."}, {"line": 118, "command": "df | jc --df -p"}, {"line": 119, "command": "cd ~"}, {"line": 120, "command": "pip3 uninstall jc"}, {"line": 121, "command": "cd git/"}, {"line": 122, "command": "ls"}, {"line": 123, "command": "rm -rf jc/"}, {"line": 124, "command": "history | grep clone"}, {"line": 125, "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": 126, "command": "ls"}, {"line": 127, "command": "cd jc/"}, {"line": 128, "command": "./build-package.sh "}, {"line": 129, "command": "./pypi-upload.sh "}, {"line": 130, "command": "cd .."}, {"line": 131, "command": "ls"}, {"line": 132, "command": "pip3 uninstall jc"}, {"line": 133, "command": "rm -rf jc/"}, {"line": 134, "command": "pip3 install --user --upgrade jc"}, {"line": 135, "command": "iptables -L | jc --iptables | jq"}, {"line": 136, "command": "sudo iptables -L | jc --iptables | jq"}, {"line": 137, "command": "mount | jc --mount -p"}, {"line": 138, "command": "uname -a | jc --uname"}, {"line": 139, "command": "uname -a | jc --uname -p"}, {"line": 140, "command": "df | jc --df -p"}, {"line": 141, "command": "free | jc --free -p"}, {"line": 142, "command": "lsblk | jc --lsblk -p"}, {"line": 143, "command": "ls | jc"}, {"line": 144, "command": "env | jc --env -p"}, {"line": 145, "command": "ls | jc"}, {"line": 146, "command": "route | jc --route -p"}, {"line": 147, "command": "iptables -L | jc --iptables | jq ."}, {"line": 148, "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": 149, "command": "ls"}, {"line": 150, "command": "pip3 uninstall jc"}, {"line": 151, "command": "history | grep clone"}, {"line": 152, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 153, "command": "cd jc/"}, {"line": 154, "command": "pip3 install --user --upgrade -e ."}, {"line": 155, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 156, "command": "sudo iptables -L | jc --iptables"}, {"line": 157, "command": "sudo iptables -L | jc --iptables | jq ."}, {"line": 158, "command": "pip3 list"}, {"line": 159, "command": "cd jc"}, {"line": 160, "command": "ls"}, {"line": 161, "command": "vi jc.py "}, {"line": 162, "command": "jc"}, {"line": 163, "command": "ls | jc"}, {"line": 164, "command": "vi jc.py "}, {"line": 165, "command": "jc"}, {"line": 166, "command": "ls | jc"}, {"line": 167, "command": "cat"}, {"line": 168, "command": "jc"}, {"line": 169, "command": "vi jc.py "}, {"line": 170, "command": "jc"}, {"line": 171, "command": "ls | jc"}, {"line": 172, "command": "vi jc.py "}, {"line": 173, "command": "jc"}, {"line": 174, "command": "vi jc.py "}, {"line": 175, "command": "jc"}, {"line": 176, "command": "ls | jc"}, {"line": 177, "command": "vi jc.py "}, {"line": 178, "command": "jc"}, {"line": 179, "command": "ls | jc"}, {"line": 180, "command": "ls | jc --ls"}, {"line": 181, "command": "jc << ls -l"}, {"line": 182, "command": "jc < ls -l"}, {"line": 183, "command": "jc < ls / -l"}, {"line": 184, "command": "jc < ls -l /"}, {"line": 185, "command": "jc <<< ls -l /"}, {"line": 186, "command": "jc --ls <<< ls -l /"}, {"line": 187, "command": "jc --ls -p <<< ls -l /"}, {"line": 188, "command": "jc --ls -p <<< 'ls -a /'"}, {"line": 189, "command": "cat jc.py "}, {"line": 190, "command": "ls"}, {"line": 191, "command": "rm jc.py "}, {"line": 192, "command": "vi jc.py"}, {"line": 193, "command": "jc"}, {"line": 194, "command": "rm jc.py "}, {"line": 195, "command": "vi jc.py"}, {"line": 196, "command": "jc"}, {"line": 197, "command": "jc --ls"}, {"line": 198, "command": "ls | jc --ls"}, {"line": 199, "command": "ls -al | jc --ls"}, {"line": 200, "command": "ls -al | jc --ls -p"}, {"line": 201, "command": "ls -al | jc --p"}, {"line": 202, "command": "jc"}, {"line": 203, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 204, "command": "mount | jc --mount -p"}, {"line": 205, "command": "jc"}, {"line": 206, "command": "jc --mount"}, {"line": 207, "command": "ps | jc --hello"}, {"line": 208, "command": "jc"}, {"line": 209, "command": "jq"}, {"line": 210, "command": "jq --help"}, {"line": 211, "command": "jc"}, {"line": 212, "command": "ps | jc -p"}, {"line": 213, "command": "ps | jc -p --ps"}, {"line": 214, "command": "jc -p --ps"}, {"line": 215, "command": "ps -ef | jc -p --ps | jq ."}, {"line": 216, "command": "jc"}, {"line": 217, "command": "df | jc --df"}, {"line": 218, "command": "env | jc --env"}, {"line": 219, "command": "free | jc --free"}, {"line": 220, "command": "ifconfig | jc --ifconfig"}, {"line": 221, "command": "jc"}, {"line": 222, "command": "iptables -L | jc --iptables"}, {"line": 223, "command": "sudo iptables -L | jc --iptables"}, {"line": 224, "command": "jc"}, {"line": 225, "command": "ls -l | jc --ls"}, {"line": 226, "command": "lsblk | jc --lsblk"}, {"line": 227, "command": "mount | jc --mount"}, {"line": 228, "command": "jc"}, {"line": 229, "command": "netstat -l | jc --netstat"}, {"line": 230, "command": "ps -ef | jc --ps"}, {"line": 231, "command": "jc"}, {"line": 232, "command": "route | jc --route"}, {"line": 233, "command": "uname -a | jc --uname"}, {"line": 234, "command": "cd parsers/"}, {"line": 235, "command": "rm iptables.py "}, {"line": 236, "command": "vi iptables.py"}, {"line": 237, "command": "sudo iptables -L | jc --iptables"}, {"line": 238, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 239, "command": "lsof"}, {"line": 240, "command": "journalctl "}, {"line": 241, "command": "python3"}, {"line": 242, "command": "ls"}, {"line": 243, "command": "vi jobs.py"}, {"line": 244, "command": "cd .."}, {"line": 245, "command": "ls"}, {"line": 246, "command": "rm jc.py "}, {"line": 247, "command": "vi jc.py"}, {"line": 248, "command": "sleep 500 &"}, {"line": 249, "command": "sleep 501 &"}, {"line": 250, "command": "sleep 502 &"}, {"line": 251, "command": "sleep 503 &"}, {"line": 252, "command": "jobs"}, {"line": 253, "command": "jobs | jc --jobs"}, {"line": 254, "command": "jobs -l | jc --jobs"}, {"line": 255, "command": "jobs -l"}, {"line": 256, "command": "python3"}, {"line": 257, "command": "ls"}, {"line": 258, "command": "cd parsers/"}, {"line": 259, "command": "ls"}, {"line": 260, "command": "rm jobs.py "}, {"line": 261, "command": "vi jobs.py"}, {"line": 262, "command": "jobs | jc --jobs"}, {"line": 263, "command": "jobs"}, {"line": 264, "command": "rm jobs"}, {"line": 265, "command": "rm jobs.py "}, {"line": 266, "command": "vi jobs"}, {"line": 267, "command": "vi jobs.py"}, {"line": 268, "command": "jobs | jc --jobs -p"}, {"line": 269, "command": "jobs -l | jc --jobs -p"}, {"line": 270, "command": "jobs"}, {"line": 271, "command": "sleep 500 &"}, {"line": 272, "command": "sleep 501 &"}, {"line": 273, "command": "sleep 502 &"}, {"line": 274, "command": "sleep 503 &"}, {"line": 275, "command": "jobs -l | jc --jobs -p"}, {"line": 276, "command": "jobs | jc --jobs -p"}, {"line": 277, "command": "rm jobs.py "}, {"line": 278, "command": "vi jobs.py"}, {"line": 279, "command": "jobs | jc --jobs -p"}, {"line": 280, "command": "jobs -l | jc --jobs -p"}, {"line": 281, "command": "jobs"}, {"line": 282, "command": "jobs -l"}, {"line": 283, "command": "rm jobs.py "}, {"line": 284, "command": "vi jobs.py"}, {"line": 285, "command": "jobs -l | jc --jobs -p"}, {"line": 286, "command": "rm jobs.py "}, {"line": 287, "command": "vi jobs.py"}, {"line": 288, "command": "sleep 500 &"}, {"line": 289, "command": "sleep 501 &"}, {"line": 290, "command": "sleep 502 &"}, {"line": 291, "command": "sleep 503 &"}, {"line": 292, "command": "sleep 504 &"}, {"line": 293, "command": "jobs"}, {"line": 294, "command": "jobs -l | jc --jobs -p"}, {"line": 295, "command": "rm jobs.py "}, {"line": 296, "command": "vi jobs.py"}, {"line": 297, "command": "sleep 1000 &"}, {"line": 298, "command": "sleep 1001 &"}, {"line": 299, "command": "sleep 1002 &"}, {"line": 300, "command": "sleep 1003 &"}, {"line": 301, "command": "sleep 1004 &"}, {"line": 302, "command": "jobs | jc --jobs -p"}, {"line": 303, "command": "jobs -l | jc --jobs -p"}, {"line": 304, "command": "python3"}, {"line": 305, "command": "rm jobs.py "}, {"line": 306, "command": "vi jobs.py"}, {"line": 307, "command": "jobs | jc --jobs -p"}, {"line": 308, "command": "rm jobs.py "}, {"line": 309, "command": "vi jobs.py"}, {"line": 310, "command": "jobs | jc --jobs -p"}, {"line": 311, "command": "rm jobs.py "}, {"line": 312, "command": "vi jobs.py"}, {"line": 313, "command": "jobs | jc --jobs -p"}, {"line": 314, "command": "rm jobs.py "}, {"line": 315, "command": "vi jobs.py"}, {"line": 316, "command": "jobs | jc --jobs -p"}, {"line": 317, "command": "jobs -l | jc --jobs -p"}, {"line": 318, "command": "jobs | jc --jobs -p"}, {"line": 319, "command": "rm jobs.py "}, {"line": 320, "command": "vi jobs.py"}, {"line": 321, "command": "jobs | jc --jobs -p"}, {"line": 322, "command": "\"\"\"jc - JSON CLI output utility jobs Parser"}, {"line": 323, "command": "Usage:"}, {"line": 324, "command": "specify --jobs as the first argument if the piped input is coming from jobs"}, {"line": 325, "command": "Examples:"}, {"line": 326, "command": "\"\"\""}, {"line": 327, "command": "import string"}, {"line": 328, "command": "def parse(data):"}, {"line": 329, "command": "output = []"}, {"line": 330, "command": "linedata = data.splitlines()"}, {"line": 331, "command": "# Clear any blank lines"}, {"line": 332, "command": "cleandata = list(filter(None, linedata))"}, {"line": 333, "command": "if cleandata:; for entry in cleandata:; output_line = {}"}, {"line": 334, "command": "job_number = ''"}, {"line": 335, "command": "pid = ''"}, {"line": 336, "command": "job_history = ''"}, {"line": 337, "command": "parsed_line = entry.split(maxsplit=2)"}, {"line": 338, "command": "print(parsed_line)"}, {"line": 339, "command": "# check if -l was used"}, {"line": 340, "command": "if parsed_line[1][0] in string.digits:; pid = parsed_line.pop(1)"}, {"line": 341, "command": "print(parsed_line)"}, {"line": 342, "command": "# check for + or - in first field"}, {"line": 343, "command": "if parsed_line[0].find('+') != -1:"}, {"line": 344, "command": "job_history = 'current'"}, {"line": 345, "command": "job_number = parsed_line[0].rstrip('+')"}, {"line": 346, "command": "if pid:; remainder = parsed_line[1].split(maxsplit=1)"}, {"line": 347, "command": "else:"}, {"line": 348, "command": "remainder = list(parsed_line[1])"}, {"line": 349, "command": "remainder.insert(0, job_number)"}, {"line": 350, "command": "parsed_line = remainder"}, {"line": 351, "command": "if parsed_line[0].find('-') != -1:"}, {"line": 352, "command": "job_history = 'previous'"}, {"line": 353, "command": "job_number = parsed_line[0].rstrip('-')"}, {"line": 354, "command": "if pid:; remainder = parsed_line[1].split(maxsplit=1)"}, {"line": 355, "command": "else:"}, {"line": 356, "command": "remainder = list(parsed_line[1])"}, {"line": 357, "command": "remainder = parsed_line[1].split(maxsplit=1)"}, {"line": 358, "command": "remainder.insert(0, job_number)"}, {"line": 359, "command": "parsed_line = remainder"}, {"line": 360, "command": "# clean up first field"}, {"line": 361, "command": "parsed_line[0] = parsed_line[0].lstrip('[').rstrip(']')"}, {"line": 362, "command": "print(parsed_line)"}, {"line": 363, "command": "# create list of dictionaries"}, {"line": 364, "command": "# output_line['job_number'] = int(parsed_line[0])"}, {"line": 365, "command": "# if pid:"}, {"line": 366, "command": "# output_line['pid'] = int(pid)"}, {"line": 367, "command": "# if job_history:"}, {"line": 368, "command": "# output_line['history'] = job_history"}, {"line": 369, "command": "# output_line['status'] = parsed_line[1]"}, {"line": 370, "command": "# output_line['command'] = parsed_line[2]"}, {"line": 371, "command": "# output.append(output_line)"}, {"line": 372, "command": "# return output"}, {"line": 373, "command": "rm jobs.py "}, {"line": 374, "command": "vi jobs.py"}, {"line": 375, "command": "jobs | jc --jobs -p"}, {"line": 376, "command": "jobs"}, {"line": 377, "command": "sleep"}, {"line": 378, "command": "sleep 1000 &"}, {"line": 379, "command": "sleep 1001 &"}, {"line": 380, "command": "sleep 1002 &"}, {"line": 381, "command": "sleep 1003 &"}, {"line": 382, "command": "sleep 1004 &"}, {"line": 383, "command": "jobs | jc --jobs -p"}, {"line": 384, "command": "jobs -l | jc --jobs -p"}, {"line": 385, "command": "rm jobs.py "}, {"line": 386, "command": "vi jobs.py"}, {"line": 387, "command": "jobs -l | jc --jobs -p"}, {"line": 388, "command": "jobs | jc --jobs -p"}, {"line": 389, "command": "rm jobs.py "}, {"line": 390, "command": "vi jobs.py"}, {"line": 391, "command": "jobs | jc --jobs -p"}, {"line": 392, "command": "jobs -l | jc --jobs -p"}, {"line": 393, "command": "jobs"}, {"line": 394, "command": "rm jobs.py "}, {"line": 395, "command": "vi jobs.py"}, {"line": 396, "command": "sleep 10000 &"}, {"line": 397, "command": "sleep 10001 &"}, {"line": 398, "command": "sleep 10002 &"}, {"line": 399, "command": "sleep 10003 &"}, {"line": 400, "command": "sleep 10004 &"}, {"line": 401, "command": "jobs -l | jc --jobs -p"}, {"line": 402, "command": "jobs | jc --jobs -p"}, {"line": 403, "command": "rm jobs.py "}, {"line": 404, "command": "vi jobs.py"}, {"line": 405, "command": "jobs | jc --jobs -p"}, {"line": 406, "command": "jobs -l| jc --jobs -p"}, {"line": 407, "command": "rm jobs.py "}, {"line": 408, "command": "vi jobs.py"}, {"line": 409, "command": "jobs -l| jc --jobs -p"}, {"line": 410, "command": "jobs | jc --jobs -p"}, {"line": 411, "command": "rm jobs.py "}, {"line": 412, "command": "vi jobs.py"}, {"line": 413, "command": "jobs | jc --jobs -p"}, {"line": 414, "command": "jobs -l | jc --jobs -p"}, {"line": 415, "command": "rm jobs.py "}, {"line": 416, "command": "vi jobs.py"}, {"line": 417, "command": "jobs -l | jc --jobs -p"}, {"line": 418, "command": "jobs| jc --jobs -p"}, {"line": 419, "command": "jc"}, {"line": 420, "command": "lsof"}, {"line": 421, "command": "yum install lsof"}, {"line": 422, "command": "sudo yum install lsof"}, {"line": 423, "command": "lsof"}, {"line": 424, "command": "vi lsof.py"}, {"line": 425, "command": "cd .."}, {"line": 426, "command": "ls"}, {"line": 427, "command": "rm jc.py "}, {"line": 428, "command": "vi jc.py"}, {"line": 429, "command": "lsof | jc --lsof"}, {"line": 430, "command": "cd parsers/"}, {"line": 431, "command": "rm lsof.py "}, {"line": 432, "command": "vi lsof.py"}, {"line": 433, "command": "lsof | jc --lsof -p"}, {"line": 434, "command": "rm lsof.py "}, {"line": 435, "command": "vi lsof.py"}, {"line": 436, "command": "lsof | jc --lsof -p"}, {"line": 437, "command": "rm lsof.py "}, {"line": 438, "command": "vi lsof.py"}, {"line": 439, "command": "lsof | jc --lsof -p"}, {"line": 440, "command": "rm lsof.py "}, {"line": 441, "command": "vi lsof.py"}, {"line": 442, "command": "lsof | jc --lsof -p"}, {"line": 443, "command": "lsof | head"}, {"line": 444, "command": "rm lsof.py "}, {"line": 445, "command": "vi lsof.py"}, {"line": 446, "command": "lsof | jc --lsof "}, {"line": 447, "command": "rm lsof.py "}, {"line": 448, "command": "vi lsof.py"}, {"line": 449, "command": "lsof | jc --lsof "}, {"line": 450, "command": "rm lsof.py "}, {"line": 451, "command": "vi lsof.py"}, {"line": 452, "command": "lsof | jc --lsof "}, {"line": 453, "command": "rm lsof.py "}, {"line": 454, "command": "vi lsof.py"}, {"line": 455, "command": "lsof | jc --lsof "}, {"line": 456, "command": "rm lsof.py "}, {"line": 457, "command": "vi lsof.py"}, {"line": 458, "command": "lsof | jc --lsof "}, {"line": 459, "command": "rm lsof.py "}, {"line": 460, "command": "vi lsof.py"}, {"line": 461, "command": "lsof | jc --lsof "}, {"line": 462, "command": "rm lsof.py "}, {"line": 463, "command": "vi lsof.py"}, {"line": 464, "command": "lsof | jc --lsof "}, {"line": 465, "command": "rm lsof.py "}, {"line": 466, "command": "vi lsof.py"}, {"line": 467, "command": "lsof | jc --lsof "}, {"line": 468, "command": "rm lsof.py "}, {"line": 469, "command": "vi lsof.py"}, {"line": 470, "command": "lsof | jc --lsof "}, {"line": 471, "command": "python3"}, {"line": 472, "command": "rm lsof.py "}, {"line": 473, "command": "vi lsof.py"}, {"line": 474, "command": "lsof | jc --lsof "}, {"line": 475, "command": "lsof"}, {"line": 476, "command": "lsof | head"}, {"line": 477, "command": "rm lsof.py "}, {"line": 478, "command": "vi lsof.py"}, {"line": 479, "command": "lsof | jc --lsof "}, {"line": 480, "command": "lsof | tail"}, {"line": 481, "command": "rm lsof.py "}, {"line": 482, "command": "vi lsof.py"}, {"line": 483, "command": "lsof | jc --lsof "}, {"line": 484, "command": "rm lsof.py "}, {"line": 485, "command": "vi lsof.py"}, {"line": 486, "command": "lsof | jc --lsof "}, {"line": 487, "command": "rm lsof.py "}, {"line": 488, "command": "vi lsof.py"}, {"line": 489, "command": "lsof | jc --lsof "}, {"line": 490, "command": "rm lsof.py "}, {"line": 491, "command": "vi lsof.py"}, {"line": 492, "command": "lsof | jc --lsof "}, {"line": 493, "command": "rm lsof.py "}, {"line": 494, "command": "vi lsof.py"}, {"line": 495, "command": "lsof | jc --lsof "}, {"line": 496, "command": "~/resizeterm.sh "}, {"line": 497, "command": "rm lsof.py "}, {"line": 498, "command": "vi lsof.py"}, {"line": 499, "command": "lsof | jc --lsof "}, {"line": 500, "command": "rm lsof.py "}, {"line": 501, "command": "vi lsof.py"}, {"line": 502, "command": "lsof | jc --lsof "}, {"line": 503, "command": "rm lsof.py "}, {"line": 504, "command": "vi lsof.py"}, {"line": 505, "command": "lsof | jc --lsof "}, {"line": 506, "command": "rm lsof.py "}, {"line": 507, "command": "vi lsof.py"}, {"line": 508, "command": "lsof | jc --lsof "}, {"line": 509, "command": "rm lsof.py "}, {"line": 510, "command": "vi lsof.py"}, {"line": 511, "command": "lsof | jc --lsof "}, {"line": 512, "command": "sudo lsof | jc --lsof "}, {"line": 513, "command": "lsof"}, {"line": 514, "command": "rm lsof.py "}, {"line": 515, "command": "vi lsof.py"}, {"line": 516, "command": "sudo lsof | jc --lsof "}, {"line": 517, "command": "rm lsof.py "}, {"line": 518, "command": "vi lsof.py"}, {"line": 519, "command": "sudo lsof | jc --lsof -p"}, {"line": 520, "command": "sudo lsof | more"}, {"line": 521, "command": "rm lsof.py "}, {"line": 522, "command": "vi lsof.py"}, {"line": 523, "command": "sudo lsof | jc --lsof -p"}, {"line": 524, "command": "lsof | jc --lsof -p"}, {"line": 525, "command": "lsof | jc --lsof"}, {"line": 526, "command": "lsof | jc --lsof | jq ."}, {"line": 527, "command": "jc"}, {"line": 528, "command": "sudo lsof | jc --lsof -p"}, {"line": 529, "command": "man lsof"}, {"line": 530, "command": "~/resizeterm.sh "}, {"line": 531, "command": "sudo lsof | jc --lsof -p"}, {"line": 532, "command": "python3"}, {"line": 533, "command": "lsmod"}, {"line": 534, "command": "~/resizeterm.sh "}, {"line": 535, "command": "lsmod"}, {"line": 536, "command": "cd ~"}, {"line": 537, "command": "pip3 uninstall jc"}, {"line": 538, "command": "cd git/"}, {"line": 539, "command": "rm -rf jc/"}, {"line": 540, "command": "pip3 install --upgrade --user -e ."}, {"line": 541, "command": "history | grep clone"}, {"line": 542, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 543, "command": "cd jc/"}, {"line": 544, "command": "pip3 install --upgrade --user -e ."}, {"line": 545, "command": "jc"}, {"line": 546, "command": "lsmod | jc --lsmod -p"}, {"line": 547, "command": "cd pypi-upload.sh "}, {"line": 548, "command": "cd jc"}, {"line": 549, "command": "cd parsers/"}, {"line": 550, "command": "ls"}, {"line": 551, "command": "rm lsmod.py "}, {"line": 552, "command": "vi lsmod.py"}, {"line": 553, "command": "lsmod | jc --lsmod -p"}, {"line": 554, "command": "rm lsmod.py "}, {"line": 555, "command": "vi lsmod.py"}, {"line": 556, "command": "lsmod | jc --lsmod -p"}, {"line": 557, "command": "rm lsmod.py "}, {"line": 558, "command": "vi lsmod.py"}, {"line": 559, "command": "lsmod | jc --lsmod -p"}, {"line": 560, "command": "rm lsmod.py "}, {"line": 561, "command": "vi lsmod.py"}, {"line": 562, "command": "lsmod | jc --lsmod -p"}, {"line": 563, "command": "rm lsmod.py "}, {"line": 564, "command": "vi lsmod.py"}, {"line": 565, "command": "lsmod | jc --lsmod -p"}, {"line": 566, "command": "rm lsmod.py "}, {"line": 567, "command": "vi lsmod.py"}, {"line": 568, "command": "lsmod | jc --lsmod -p"}, {"line": 569, "command": "rm lsmod.py "}, {"line": 570, "command": "vi lsmod.py"}, {"line": 571, "command": "lsmod | jc --lsmod -p"}, {"line": 572, "command": "rm lsmod.py "}, {"line": 573, "command": "vi lsmod.py"}, {"line": 574, "command": "lsmod | jc --lsmod -p"}, {"line": 575, "command": "rm lsmod.py "}, {"line": 576, "command": "vi lsmod.py"}, {"line": 577, "command": "lsmod | jc --lsmod -p"}, {"line": 578, "command": "jc"}, {"line": 579, "command": "cd ~"}, {"line": 580, "command": "pip3 uninstall jc"}, {"line": 581, "command": "cd git/"}, {"line": 582, "command": "rm -rf jc/"}, {"line": 583, "command": "history | grep clone"}, {"line": 584, "command": "ls"}, {"line": 585, "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": 586, "command": "cd jc/"}, {"line": 587, "command": "ls"}, {"line": 588, "command": "./build-package.sh "}, {"line": 589, "command": "ls"}, {"line": 590, "command": "./pypi-upload.sh "}, {"line": 591, "command": "cd .."}, {"line": 592, "command": "ls"}, {"line": 593, "command": "pip3 uninstall jc"}, {"line": 594, "command": "rm -rf jc/"}, {"line": 595, "command": "pip3 install --upgrade --user jc"}, {"line": 596, "command": "pip3 list"}, {"line": 597, "command": "jc"}, {"line": 598, "command": "jc -p"}, {"line": 599, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 600, "command": "jc"}, {"line": 601, "command": "lsmod | jc --lsmod -p"}, {"line": 602, "command": "jc"}, {"line": 603, "command": "jobs"}, {"line": 604, "command": "sleep 500 &"}, {"line": 605, "command": "jobs -l | jc --jobs -p"}, {"line": 606, "command": "jobs | jc --jobs -p"}, {"line": 607, "command": "lsof"}, {"line": 608, "command": "cd ~"}, {"line": 609, "command": "pip3 list"}, {"line": 610, "command": "lsof | jc --lsof > testfile"}, {"line": 611, "command": "cat testfile "}, {"line": 612, "command": "iptables -L | jc --iptables > testfile "}, {"line": 613, "command": "sudo iptables -L | jc --iptables > testfile "}, {"line": 614, "command": "cat testfile "}, {"line": 615, "command": "cat testfile | jq ."}, {"line": 616, "command": "w"}, {"line": 617, "command": "w -h"}, {"line": 618, "command": "w --help"}, {"line": 619, "command": "w -f"}, {"line": 620, "command": "w -i"}, {"line": 621, "command": "w -s"}, {"line": 622, "command": "w -o"}, {"line": 623, "command": "date"}, {"line": 624, "command": "ls | jc --ls"}, {"line": 625, "command": "ls | jc --ls | jq '.select(\"filename\" = \"git)'"}, {"line": 626, "command": "ls | jc --ls | jq '.select(.filename=\"git)'"}, {"line": 627, "command": "ls | jc --ls | jq '.select(.filename=\"git\")'"}, {"line": 628, "command": "ls | jc --ls | jq 'select(.filename == \"git\")'"}, {"line": 629, "command": "ls | jc --ls | jq '.[] | select(.filename == \"git\")'"}, {"line": 630, "command": "ls | jc --ls | jq -r '.[] | select(.filename == \"git\")'"}, {"line": 631, "command": "ls | jc --ls | jq -r '.[] | select(.filename == \"git\") | .filename'"}, {"line": 632, "command": "ifconfig | jc --ifconfig -p"}, {"line": 633, "command": "jc -p"}, {"line": 634, "command": "jc"}, {"line": 635, "command": "ls | jc -p"}, {"line": 636, "command": "ip"}, {"line": 637, "command": "ip address"}, {"line": 638, "command": "ip --help"}, {"line": 639, "command": "ip address --help"}, {"line": 640, "command": "ip address -h"}, {"line": 641, "command": "ip -h address"}, {"line": 642, "command": "ip -b address"}, {"line": 643, "command": "ip -iec address"}, {"line": 644, "command": "ip address"}, {"line": 645, "command": "ip --help"}, {"line": 646, "command": "ip -br address"}, {"line": 647, "command": "ip -d address"}, {"line": 648, "command": "ifconfig"}, {"line": 649, "command": "cat"}, {"line": 650, "command": "jc"}, {"line": 651, "command": "jc | cat"}, {"line": 652, "command": "jc > testing"}, {"line": 653, "command": "cat testing "}, {"line": 654, "command": "rm testing "}, {"line": 655, "command": "jc &2 > testing"}, {"line": 656, "command": "cat testing "}, {"line": 657, "command": "ls"}, {"line": 658, "command": "cat testing "}, {"line": 659, "command": "rm testing "}, {"line": 660, "command": "jc 2>&1 | jc --ls"}, {"line": 661, "command": "jc 2>&1 | jc --ls -p"}, {"line": 662, "command": "jc 2>&1 | jc --route -p"}, {"line": 663, "command": "jc 2>&1 | jc --ps -p"}, {"line": 664, "command": "jc 2>&1 | jc --iptables -p"}, {"line": 665, "command": "jc 2>&1 | jc --lsof -p"}, {"line": 666, "command": "jc 2>&1 | jc --ls -p"}, {"line": 667, "command": "jc 2>&1 | jc --env -p"}, {"line": 668, "command": "jc 2>&1 | jc --netstat -p"}, {"line": 669, "command": "jc 2>&1 | jc --uname -p"}, {"line": 670, "command": "jc"}, {"line": 671, "command": "journalctl "}, {"line": 672, "command": "man journalctl"}, {"line": 673, "command": "man journalctl -o=json"}, {"line": 674, "command": "journalctl -o=json"}, {"line": 675, "command": "journalctl -o json"}, {"line": 676, "command": "journalctl -o json >journaljson"}, {"line": 677, "command": "cat journaljson "}, {"line": 678, "command": "dig"}, {"line": 679, "command": "uptime"}, {"line": 680, "command": "uptime --help"}, {"line": 681, "command": "uptime -p"}, {"line": 682, "command": "uptime -s"}, {"line": 683, "command": "uptime "}, {"line": 684, "command": "date"}, {"line": 685, "command": "uptime"}, {"line": 686, "command": "history"}, {"line": 687, "command": "pip3 uninstall jc"}, {"line": 688, "command": "cd git/"}, {"line": 689, "command": "ls"}, {"line": 690, "command": "history | grep clone"}, {"line": 691, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 692, "command": "cd jc"}, {"line": 693, "command": "pip3 install --upgrade --user -e ."}, {"line": 694, "command": "jc"}, {"line": 695, "command": "w | jc --w -p"}, {"line": 696, "command": "history | jc --history"}, {"line": 697, "command": "history"}, {"line": 698, "command": "history | jc --history -p"}, {"line": 699, "command": "history | head"}, {"line": 700, "command": "cd jc/parsers/"}, {"line": 701, "command": "vi history.py "}, {"line": 702, "command": "history | jc --history -p"}, {"line": 703, "command": "vi history.py "}, {"line": 704, "command": "history | jc --history -p"}, {"line": 705, "command": "echo \"hello\""}, {"line": 706, "command": "history | jc --history -p"}, {"line": 707, "command": "cat history.py "}, {"line": 708, "command": "rm history.py "}, {"line": 709, "command": "vi history.py"}, {"line": 710, "command": "history | jc --history -p"}, {"line": 711, "command": "history | jc --history"}, {"line": 712, "command": "history | jc --history -p"}, {"line": 713, "command": "history | jc --history -p | jq .1700"}, {"line": 714, "command": "history | jc --history -p | jq .1709"}, {"line": 715, "command": "history | jc --history | jq .1709"}, {"line": 716, "command": "history | jc --history | jq ."}, {"line": 717, "command": "history | jc --history | jq .\"1713\""}, {"line": 718, "command": "history | jc --history | jq .[1713]"}, {"line": 719, "command": "history | jc --history | jq .[\"1713\"]"}, {"line": 720, "command": "history | jc --history | jq '.1713'"}, {"line": 721, "command": "history | jc --history | jq '.[1713]'"}, {"line": 722, "command": "history | jc --history | jq '.[\"1713\"]'"}, {"line": 723, "command": "rm history.py "}, {"line": 724, "command": "vi history.py"}, {"line": 725, "command": "history | jc --history -p"}, {"line": 726, "command": "history | jc --history -p | jq .n1723"}, {"line": 727, "command": "cd ~"}, {"line": 728, "command": "pip3 uninstall jc"}, {"line": 729, "command": "cd git/"}, {"line": 730, "command": "rm -rf jc/"}, {"line": 731, "command": "history | grep clone"}, {"line": 732, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 733, "command": "cd jc/"}, {"line": 734, "command": "pip3 install --upgrade --user -e ."}, {"line": 735, "command": "jc"}, {"line": 736, "command": "history | jc --history -p"}, {"line": 737, "command": "jc"}, {"line": 738, "command": "w | jc --w -p"}, {"line": 739, "command": "uptime | jc --uptime -p"}, {"line": 740, "command": "ls"}, {"line": 741, "command": "stat build-package.sh "}, {"line": 742, "command": "ls"}, {"line": 743, "command": "stat jc.egg-info/"}, {"line": 744, "command": "stat README.md "}, {"line": 745, "command": "lstat"}, {"line": 746, "command": "cd /proc/"}, {"line": 747, "command": "ls"}, {"line": 748, "command": "cd 1"}, {"line": 749, "command": "ls"}, {"line": 750, "command": "ls -al"}, {"line": 751, "command": "cd attr/"}, {"line": 752, "command": "ls"}, {"line": 753, "command": "ls -al"}, {"line": 754, "command": "cat current "}, {"line": 755, "command": "cat exec "}, {"line": 756, "command": "cat prev "}, {"line": 757, "command": "dig"}, {"line": 758, "command": "sudo yum install dig"}, {"line": 759, "command": "sudo yum install bind-utils"}, {"line": 760, "command": "dig"}, {"line": 761, "command": "dig www.google.com"}, {"line": 762, "command": "dig www.cnn.com"}, {"line": 763, "command": "man dig"}, {"line": 764, "command": "dig www.cnn.com www.google.com"}, {"line": 765, "command": "pip3 list"}, {"line": 766, "command": "cd ~/git/jc/jc/parsers/"}, {"line": 767, "command": "rm history.py "}, {"line": 768, "command": "vi history.py"}, {"line": 769, "command": "history | jc --history"}, {"line": 770, "command": "history | jc --history -p"}, {"line": 771, "command": "ifconfig | jc --ifconfig -p"}, {"line": 772, "command": "rm iptables.py "}, {"line": 773, "command": "vi iptables.py"}, {"line": 774, "command": "iptables -L | jc --iptables -p"}, {"line": 775, "command": "sudo iptables -L | jc --iptables -p"}, {"line": 776, "command": "lsblk | jc --lsblk -p"}, {"line": 777, "command": "rm lsblk.py "}, {"line": 778, "command": "vi lsblk.py"}, {"line": 779, "command": "lsblk | jc --lsblk -p"}, {"line": 780, "command": "rm lsmod.py "}, {"line": 781, "command": "vi lsmod.py"}, {"line": 782, "command": "lsmod"}, {"line": 783, "command": "lsmod | jc --lsmod -p"}, {"line": 784, "command": "rm lsof.py "}, {"line": 785, "command": "vi lsof.py"}, {"line": 786, "command": "lsof | jc --lsof -p"}, {"line": 787, "command": "sudo lsof | jc --lsof -p"}, {"line": 788, "command": "sudo lsof | jc --lsof | jq ."}, {"line": 789, "command": "ps | jc --ps -p"}, {"line": 790, "command": "clear"}, {"line": 791, "command": "rm ps.py "}, {"line": 792, "command": "vi ps.py"}, {"line": 793, "command": "ps | jc --ps -p"}, {"line": 794, "command": "ps axu | jc --ps -p"}, {"line": 795, "command": "rm ps.py "}, {"line": 796, "command": "vi ps.py"}, {"line": 797, "command": "ps | jc --ps -p"}, {"line": 798, "command": "ps axu | jc --ps -p"}, {"line": 799, "command": "ps -ef | jc --ps -p"}, {"line": 800, "command": "ps -ef | jc --ps -p | jq ."}, {"line": 801, "command": "ps axu | jc --ps -p | jq ."}, {"line": 802, "command": "ps -ef | jc --ps -p"}, {"line": 803, "command": "ls"}, {"line": 804, "command": "rm route.py "}, {"line": 805, "command": "vi route.py"}, {"line": 806, "command": "route | jc --route -p"}, {"line": 807, "command": "w | jc --w -p"}, {"line": 808, "command": "rm w.py "}, {"line": 809, "command": "vi w.py"}, {"line": 810, "command": "w | jc --w -p"}, {"line": 811, "command": "rm ls.py "}, {"line": 812, "command": "vi ls.py"}, {"line": 813, "command": "ls -lh | jc --ps -p"}, {"line": 814, "command": "ls | jc --ls -p"}, {"line": 815, "command": "ls -alh | jc --ls -p"}, {"line": 816, "command": "ls -lh | jc --ls -p"}, {"line": 817, "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.bytes|tonumber > 50000000)'"}, {"line": 818, "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.size|tonumber > 50000000)'"}, {"line": 819, "command": "ls -l /usr/bin | jc --ls | jq '.[] | select(.size|tonumber > 5000000)'"}, {"line": 820, "command": "$ ls -l /bin | jc --ls -p"}, {"line": 821, "command": "ls -l /bin | jc --ls -p"}, {"line": 822, "command": "python3"}, {"line": 823, "command": "rm jobs.py "}, {"line": 824, "command": "vi jobs.py"}, {"line": 825, "command": "sleep 1000 &"}, {"line": 826, "command": "sleep 1001 &"}, {"line": 827, "command": "sleep 1002 &"}, {"line": 828, "command": "sleep 1003 &"}, {"line": 829, "command": "jobs | jc --jobs -p"}, {"line": 830, "command": "jobs -l | jc --jobs -p"}, {"line": 831, "command": "rm ls.py "}, {"line": 832, "command": "vi ls.py"}, {"line": 833, "command": "ls -al | jc --ls -p"}, {"line": 834, "command": "ls -alh | jc --ls -p"}, {"line": 835, "command": "ls -al /usr/bin | jc --ls -p"}, {"line": 836, "command": "ls /usr/bin | jc --ls -p"}, {"line": 837, "command": "rm netstat.py "}, {"line": 838, "command": "vi netstat.py"}, {"line": 839, "command": "history | grep netstat"}, {"line": 840, "command": "netstat -l | jc --netstat -p"}, {"line": 841, "command": "netstat -lv | jc --netstat -p"}, {"line": 842, "command": "netstat -ln | jc --netstat -p"}, {"line": 843, "command": "sudo netstat -lpn | jc --netstat -p"}, {"line": 844, "command": "sudo systemctl restart"}, {"line": 845, "command": "reboot"}, {"line": 846, "command": "jc"}, {"line": 847, "command": "w | jc --w -p"}, {"line": 848, "command": "uptime | jc --uptime -p"}, {"line": 849, "command": "uptime"}, {"line": 850, "command": "cd git/jc/jc/parsers/"}, {"line": 851, "command": "rm uptime.py "}, {"line": 852, "command": "vi uptime.py"}, {"line": 853, "command": "uptime | jc --uptime -p"}, {"line": 854, "command": "~/resizeterm.sh "}, {"line": 855, "command": "rm uptime.py "}, {"line": 856, "command": "vi uptime.py"}, {"line": 857, "command": "uptime | jc --uptime -p"}, {"line": 858, "command": "w | jc --w -p"}, {"line": 859, "command": "uptime | jc --uptime -p"}, {"line": 860, "command": "cd .."}, {"line": 861, "command": "ls"}, {"line": 862, "command": "rm jc.py "}, {"line": 863, "command": "vi jc.py"}, {"line": 864, "command": "lsof | jc --lsof -p"}, {"line": 865, "command": "cat jc.py "}, {"line": 866, "command": "uptime | jc --uptime -p"}, {"line": 867, "command": "vi jc.py "}, {"line": 868, "command": "rm jc.py "}, {"line": 869, "command": "vi jc.py"}, {"line": 870, "command": "jc"}, {"line": 871, "command": "lsof | jc --lsof -p"}, {"line": 872, "command": "uptime | jc --uptime -p"}, {"line": 873, "command": "lsof | jc --lsof -p"}, {"line": 874, "command": "sudo lsof | jc --lsof -p"}, {"line": 875, "command": "uptime | jc --uptime -p"}, {"line": 876, "command": "ls"}, {"line": 877, "command": "cd .."}, {"line": 878, "command": "ls"}, {"line": 879, "command": "pip3 uninstall jc"}, {"line": 880, "command": "rm -rf jc/"}, {"line": 881, "command": "history | grep clone"}, {"line": 882, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 883, "command": "cd jc/"}, {"line": 884, "command": "pip3 install --upgrade --user -e ."}, {"line": 885, "command": "jc"}, {"line": 886, "command": "uptime | jc --uptime -p"}, {"line": 887, "command": "uptime | jc --uptime"}, {"line": 888, "command": "lsof | jc --lsof -p"}, {"line": 889, "command": "ls"}, {"line": 890, "command": "cat changelog.txt "}, {"line": 891, "command": "env | jc -env -p"}, {"line": 892, "command": "env | jc --env -p"}, {"line": 893, "command": "history | jc --history -p"}, {"line": 894, "command": "history | jc --history | jq 'select(\"vi\")'"}, {"line": 895, "command": "history | jc --history | jq 'select(.value=\"ls\")'"}, {"line": 896, "command": "history | jc --history | jq 'select(.value==\"ls\")'"}, {"line": 897, "command": "history | jc --history | jq 'select(.value==\"jc\")'"}, {"line": 898, "command": "history | jc --history | jq 'select(.value == jc)'"}, {"line": 899, "command": "history | jc --history -p"}, {"line": 900, "command": "uptime | jc --uptime -p"}, {"line": 901, "command": "pip3 list"}, {"line": 902, "command": "pip3 install --upgrade pip"}, {"line": 903, "command": "pip3 install --upgrade --user pip"}, {"line": 904, "command": "pip3 list"}, {"line": 905, "command": "jc"}, {"line": 906, "command": "df | jc --df -p"}, {"line": 907, "command": "jc"}, {"line": 908, "command": "env | jc --env -p"}, {"line": 909, "command": "env | jc --env"}, {"line": 910, "command": "env | jc --env | jq '. paths'"}, {"line": 911, "command": "env | jc --env | jq 'paths()'"}, {"line": 912, "command": "env | jc --env | jq '[paths(\"ls\")]'"}, {"line": 913, "command": "env"}, {"line": 914, "command": "env | jc --env | jq '[paths(\"kbrazil\")]'"}, {"line": 915, "command": "uptime | jc --uptime -p"}, {"line": 916, "command": "jc"}, {"line": 917, "command": "free | jc --free -p"}, {"line": 918, "command": "history | jc --history"}, {"line": 919, "command": "jc"}, {"line": 920, "command": "ifconfig | jc --ifconfig -p"}, {"line": 921, "command": "jc"}, {"line": 922, "command": "sudo iptables -vnL | jc --iptables -p"}, {"line": 923, "command": "jc"}, {"line": 924, "command": "sudo iptables -vnL | jc --iptables -p"}, {"line": 925, "command": "ls"}, {"line": 926, "command": "jc"}, {"line": 927, "command": "jobs | jc --jobs -p"}, {"line": 928, "command": "jobs -p| jc --jobs -p"}, {"line": 929, "command": "jobs -a| jc --jobs -p"}, {"line": 930, "command": "jobs -l| jc --jobs -p"}, {"line": 931, "command": "sleep 100 &"}, {"line": 932, "command": "jobs -l| jc --jobs -p"}, {"line": 933, "command": "jc"}, {"line": 934, "command": "ls -alh | jc --ls -p"}, {"line": 935, "command": "jc"}, {"line": 936, "command": "lsblk | jc --lsblk -p"}, {"line": 937, "command": "uptime | jc --uptime -p"}, {"line": 938, "command": "jc"}, {"line": 939, "command": "lsmod | jc --lsmod -p"}, {"line": 940, "command": "jc"}, {"line": 941, "command": "lsof | jc --lsof -p"}, {"line": 942, "command": "sudo lsof | jc --lsof -p"}, {"line": 943, "command": "uptime | jc --uptime -p"}, {"line": 944, "command": "uptime | jc --uptime | jq ."}, {"line": 945, "command": "uptime"}, {"line": 946, "command": "uptime | jc --uptime | jq ."}, {"line": 947, "command": "uptime | jc --uptime -p"}, {"line": 948, "command": "cd jc/parsers/"}, {"line": 949, "command": "rm uptime.py "}, {"line": 950, "command": "vi uptime.py"}, {"line": 951, "command": "uptime | jc --uptime -p"}, {"line": 952, "command": "rm uptime.py "}, {"line": 953, "command": "vi uptime.py"}, {"line": 954, "command": "rm uptime.py "}, {"line": 955, "command": "vi uptime.py"}, {"line": 956, "command": "uptime | jc --uptime -p"}, {"line": 957, "command": "uptime"}, {"line": 958, "command": "rm uptime.py "}, {"line": 959, "command": "vi uptime.py"}, {"line": 960, "command": "uptime | jc --uptime -p"}, {"line": 961, "command": "rm uptime.py "}, {"line": 962, "command": "vi uptime.py"}, {"line": 963, "command": "uptime | jc --uptime -p"}, {"line": 964, "command": "rm uptime.py "}, {"line": 965, "command": "vi uptime.py"}, {"line": 966, "command": "uptime | jc --uptime -p"}, {"line": 967, "command": "rm uptime.py "}, {"line": 968, "command": "vi uptime.py"}, {"line": 969, "command": "uptime | jc --uptime -p"}, {"line": 970, "command": "reboot"}, {"line": 971, "command": "uptime"}, {"line": 972, "command": "uptime | jc --uptime -p"}, {"line": 973, "command": "python3"}, {"line": 974, "command": "uptime | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": 975, "command": "echo '22:19 up 54 days, 1 min, 4 users, load averages: 2.08 2.06 2.27' | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": 976, "command": "~/resizeterm.sh "}, {"line": 977, "command": "echo '22:19 up 54 days, 1 min, 4 users, load averages: 2.08 2.06 2.27' | sed -E 's/.*(up.*), [[:digit:]]+ user.*/\\1/'"}, {"line": 978, "command": "uptime | jc --uptime -p"}, {"line": 979, "command": "cd git/jc/jc/parsers/"}, {"line": 980, "command": "rm uptime.py "}, {"line": 981, "command": "vi uptime.py"}, {"line": 982, "command": "uptime | jc --uptime -p"}, {"line": 983, "command": "rm uptime.py "}, {"line": 984, "command": "vi uptime.py"}, {"line": 985, "command": "uptime | jc --uptime -p"}, {"line": 986, "command": "python3"}, {"line": 987, "command": "uptime | jc --uptime -p"}, {"line": 988, "command": "rm uptime.py "}, {"line": 989, "command": "vi uptime.py"}, {"line": 990, "command": "uptime | jc --uptime -p"}, {"line": 991, "command": "rm uptime.py "}, {"line": 992, "command": "vi uptime.py"}, {"line": 993, "command": "uptime | jc --uptime -p"}, {"line": 994, "command": "reboot"}, {"line": 995, "command": "ls"}, {"line": 996, "command": "w"}, {"line": 997, "command": "mkdir testfiles"}, {"line": 998, "command": "ls"}, {"line": 999, "command": "cat testfile"}, {"line": 1000, "command": "rm testfile"}, {"line": 1001, "command": "ls"}, {"line": 1002, "command": "cd testfiles/"}, {"line": 1003, "command": "vi tests.sh"}, {"line": 1004, "command": "chmod +x tests.sh "}, {"line": 1005, "command": "ls"}, {"line": 1006, "command": "./tests.sh "}, {"line": 1007, "command": "ls"}, {"line": 1008, "command": "cat jobs.out "}, {"line": 1009, "command": "cat w.out "}, {"line": 1010, "command": "cat uname-a.out "}, {"line": 1011, "command": "jc"}, {"line": 1012, "command": "rm tests.sh "}, {"line": 1013, "command": "vi tests.sh"}, {"line": 1014, "command": "chmod +x tests.sh "}, {"line": 1015, "command": "./tests.sh "}, {"line": 1016, "command": "uptime "}, {"line": 1017, "command": "rm tests.sh "}, {"line": 1018, "command": "vi tests.sh"}, {"line": 1019, "command": "chmod +x tests.sh "}, {"line": 1020, "command": "./tests.sh "}, {"line": 1021, "command": "ls"}, {"line": 1022, "command": "cat uptime.out "}, {"line": 1023, "command": "cat uptime.out | jc --uptime -p"}, {"line": 1024, "command": "route -n > route-n.out"}, {"line": 1025, "command": "cat route-n.out "}, {"line": 1026, "command": "route -vn"}, {"line": 1027, "command": "rm route-n.out "}, {"line": 1028, "command": "ls"}, {"line": 1029, "command": "cat iptables-filter-nv.out "}, {"line": 1030, "command": "cat iptables-filter-nv.out | jc --iptables -p"}, {"line": 1031, "command": "ls"}, {"line": 1032, "command": "cat iptables-mangle.out "}, {"line": 1033, "command": "rm tests.sh "}, {"line": 1034, "command": "vi tests.sh"}, {"line": 1035, "command": "chmod +x tests.sh "}, {"line": 1036, "command": "./tests.sh "}, {"line": 1037, "command": "ls"}, {"line": 1038, "command": "ls -al"}, {"line": 1039, "command": "cat history.out "}, {"line": 1040, "command": "history"}, {"line": 1041, "command": "history > kbhistory.out"}, {"line": 1042, "command": "cat kbhistory.out "}, {"line": 1043, "command": "rm kbhistory.out "}, {"line": 1044, "command": "ls"}, {"line": 1045, "command": "ls -al"}, {"line": 1046, "command": "rm tests.sh "}, {"line": 1047, "command": "vi tests.sh"}, {"line": 1048, "command": "chmod +x tests.sh "}, {"line": 1049, "command": "./tests.sh "}, {"line": 1050, "command": "ls -al"}, {"line": 1051, "command": "vi iptables-filter.out "}, {"line": 1052, "command": "uname -a"}, {"line": 1053, "command": "cd /"}, {"line": 1054, "command": "ls"}, {"line": 1055, "command": "cd etc/"}, {"line": 1056, "command": "ls"}, {"line": 1057, "command": "cat environment "}, {"line": 1058, "command": "cat centos-release"}, {"line": 1059, "command": "lsb_release -a"}, {"line": 1060, "command": "ifconfig"}, {"line": 1061, "command": "cd ~"}, {"line": 1062, "command": "ls"}, {"line": 1063, "command": "cd testfiles/"}, {"line": 1064, "command": "history > history.out "}] diff --git a/tests/fixtures/centos-7.7/id.json b/tests/fixtures/centos-7.7/id.json new file mode 100644 index 00000000..4766280e --- /dev/null +++ b/tests/fixtures/centos-7.7/id.json @@ -0,0 +1 @@ +{"uid": {"id": 1000, "name": "kbrazil"}, "gid": {"id": 1000, "name": "kbrazil"}, "groups": [{"id": 1000, "name": "kbrazil"}, {"id": 10, "name": "wheel"}], "context": {"user": "unconfined_u", "role": "unconfined_r", "type": "unconfined_t", "level": "s0-s0:c0.c1023"}} diff --git a/tests/fixtures/centos-7.7/id.out b/tests/fixtures/centos-7.7/id.out new file mode 100644 index 00000000..d74f1c9f --- /dev/null +++ b/tests/fixtures/centos-7.7/id.out @@ -0,0 +1 @@ +uid=1000(kbrazil) gid=1000(kbrazil) groups=1000(kbrazil),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 diff --git a/tests/fixtures/generic/ini-iptelserver.ini b/tests/fixtures/generic/ini-iptelserver.ini new file mode 100644 index 00000000..9b46c75f --- /dev/null +++ b/tests/fixtures/generic/ini-iptelserver.ini @@ -0,0 +1,133 @@ +[Settings] +#====================================================================== +# Set detailed log for additional debugging info +DetailedLog=1 +RunStatus=1 +StatusPort=6090 +StatusRefresh=10 +Archive=1 +# Sets the location of the MV_FTP log file +LogFile=/opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log +#====================================================================== +Version=0.9 Build 4 Created July 11 2004 14:00 +ServerName=Unknown +[FTP] +#====================================================================== +# set the FTP server active +RunFTP=1 +# defines the FTP control port +FTPPort=21 +# defines the FTP data port +FTPDataPort=20 +# Sets the location of the FTP data directory to catch terminal backups +FTPDir=/opt/ecs/mvuser/MV_IPTel/data/FTPdata +# FTP Timeout (secs) +FTP_TimeOut=5 +# Enable SuperUser +EnableSU=1 +# set the SuperUser Name +SUUserName=mvuser +# set the SuperUser Password +SUPassword=Avaya +# +#====================================================================== +[FTPS] +#====================================================================== +# set the FTPS server active +RunFTPS=0 +# defines the FTP control port +FTPPort=990 +# defines the FTP data port +FTPDataPort=889 +#====================================================================== +[TFTP] +#====================================================================== +# set the Trivial FTP server active +RunTrivialFTP=1 +# defines the Trivial FTP port +TrivialFTPPort=69 +# Sets the location of the TFTP data directory for terminal downloads +TFTPDir=/opt/ecs/mvuser/MV_IPTel/data/TFTPdata +#====================================================================== +[HTTP] +#====================================================================== +# set the HTTP download server active +RunHTTP=1 +# defines the HTTP download port +HTTPPort=81 +# Sets the location of the HTTP data directory for downloads +HTTPDir=/opt/ecs/mvuser/MV_IPTel/data/HTTPdata +#====================================================================== +[HTTPS] +#====================================================================== +# set the HTTPS download server active +RunHTTPS=0 +# defines the HTTPS download port +HTTPSPort=411 +# Sets the location of the HTTPS data directory for downloads +HTTPSDir=/opt/ecs/mvuser/MV_IPTel/data/HTTPSdata +# Sets the location of the CertFile +CertFile=/opt/ecs/mvuser/MV_IPTel/certs/IPTelcert.pem +# Sets the location of the KeyFile +KeyFile=/opt/ecs/mvuser/MV_IPTel/certs/IPTelkey.pem +# Use Client Authorization +ClientAuth=0 +# narrow config for Avaya IPTel (TLSV1 using RSA_NULL_SHA) +IPTel=0 +# sets the SSL variants if not Avaya IPtel (IPTel=0) +SSLV2=0 +SSLV3=0 +TLSV1=1 +UseProxy=0 +ProxyAddr=simon.avaya.com +ProxyPort=9000 +#====================================================================== +[BACKUP_SERVERS] +#====================================================================== +# Run as FileServer for Backup & Update requests - Note this process uses HTTPS +FileServer=0 +# sets whether to download Firmware updates from the primary/secondary file servers +RequestUpdates=0 +# sets whether to upload FTP files to the primary/secondary file servers +RequestBackup=0 +# Enable use of the Primary file server +UsePrimarySvr=0 +# Primary file server IP address ( or resolvable DNS) +PrimaryIP=192.168.0.13 +# Enable use of the Secondary file server +UseSecondarySvr=0 +# Secondary file server IP address ( or resolvable DNS) +SecondaryIP=192.168.0.10 +# Sets the update interval for Backups & updates ; 1 = min; 2 =hour, 3=day, 4 =month +UpdateInterval=2 +#Send FTP backup to the customer sever +CustomFTP=1 +# FTP backup directory customer sever +CustomFTPDir=home/mvuser/backup +# FTP backup directory user login name +CustomFTPUName=tom +# FTP backup directory user password +CustomFTPPwd=jerry +# Enable CDR Backup - enable=1 on both File Server & Client +CDRBackup=0 +# Enable BCMS Backup - enable=1 on both File Server & Client +BCMSBackup=0 +# Retain CDR / BCMS copy data for x days ( Receiver always + 1 week) +RetainDays=7.0 +#====================================================================== +[SNMP] +#================================================================ +# +# Validate FTP store with SNMP check +UseSNMP=1 +# In case the SNMPGET syntax changes you can redefine the commands +# Uncomment the relevant line to override the internal command +#the syntax is "Command + IPADDR + ExtObj + Awk +# the IPADRR is derived from the connection +# Note there are relavant spaces at the start/end of the component - omit and it will fail +#Command=/usr/bin/snmpget +#Params= -v2c -cpublic +#ExtObject=.1.3.6.1.4.1.6889.2.69.1.4.9.0 +#TypeObject=.1.3.6.1.4.1.6889.2.69.1.1.2.0 +#Awk=| awk -F \" '' {print $2 } '' +#================================================================ diff --git a/tests/fixtures/generic/ini-iptelserver.json b/tests/fixtures/generic/ini-iptelserver.json new file mode 100644 index 00000000..68a0d7d4 --- /dev/null +++ b/tests/fixtures/generic/ini-iptelserver.json @@ -0,0 +1 @@ +{"Settings": {"detailedlog": "1", "runstatus": "1", "statusport": "6090", "statusrefresh": "10", "archive": "1", "logfile": "/opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log", "version": "0.9 Build 4 Created July 11 2004 14:00", "servername": "Unknown"}, "FTP": {"runftp": "1", "ftpport": "21", "ftpdataport": "20", "ftpdir": "/opt/ecs/mvuser/MV_IPTel/data/FTPdata", "ftp_timeout": "5", "enablesu": "1", "suusername": "mvuser", "supassword": "Avaya"}, "FTPS": {"runftps": "0", "ftpport": "990", "ftpdataport": "889"}, "TFTP": {"runtrivialftp": "1", "trivialftpport": "69", "tftpdir": "/opt/ecs/mvuser/MV_IPTel/data/TFTPdata"}, "HTTP": {"runhttp": "1", "httpport": "81", "httpdir": "/opt/ecs/mvuser/MV_IPTel/data/HTTPdata"}, "HTTPS": {"runhttps": "0", "httpsport": "411", "httpsdir": "/opt/ecs/mvuser/MV_IPTel/data/HTTPSdata", "certfile": "/opt/ecs/mvuser/MV_IPTel/certs/IPTelcert.pem", "keyfile": "/opt/ecs/mvuser/MV_IPTel/certs/IPTelkey.pem", "clientauth": "0", "iptel": "0", "sslv2": "0", "sslv3": "0", "tlsv1": "1", "useproxy": "0", "proxyaddr": "simon.avaya.com", "proxyport": "9000"}, "BACKUP_SERVERS": {"fileserver": "0", "requestupdates": "0", "requestbackup": "0", "useprimarysvr": "0", "primaryip": "192.168.0.13", "usesecondarysvr": "0", "secondaryip": "192.168.0.10", "updateinterval": "2", "customftp": "1", "customftpdir": "home/mvuser/backup", "customftpuname": "tom", "customftppwd": "jerry", "cdrbackup": "0", "bcmsbackup": "0", "retaindays": "7.0"}, "SNMP": {"usesnmp": "1"}} diff --git a/tests/fixtures/generic/ini-test.ini b/tests/fixtures/generic/ini-test.ini new file mode 100644 index 00000000..3dd29875 --- /dev/null +++ b/tests/fixtures/generic/ini-test.ini @@ -0,0 +1,12 @@ +[DEFAULT] +ServerAliveInterval = 45 +Compression = yes +CompressionLevel = 9 +ForwardX11 = yes + +[bitbucket.org] +User = hg + +[topsecret.server.com] +Port = 50022 +ForwardX11 = no diff --git a/tests/fixtures/generic/ini-test.json b/tests/fixtures/generic/ini-test.json new file mode 100644 index 00000000..30d55804 --- /dev/null +++ b/tests/fixtures/generic/ini-test.json @@ -0,0 +1 @@ +{"bitbucket.org": {"serveraliveinterval": "45", "compression": "yes", "compressionlevel": "9", "forwardx11": "yes", "user": "hg"}, "topsecret.server.com": {"serveraliveinterval": "45", "compression": "yes", "compressionlevel": "9", "forwardx11": "no", "port": "50022"}} diff --git a/tests/fixtures/generic/xml-cd_catalog.json b/tests/fixtures/generic/xml-cd_catalog.json new file mode 100644 index 00000000..25091de8 --- /dev/null +++ b/tests/fixtures/generic/xml-cd_catalog.json @@ -0,0 +1 @@ +{"CATALOG": {"CD": [{"TITLE": "Empire Burlesque", "ARTIST": "Bob Dylan", "COUNTRY": "USA", "COMPANY": "Columbia", "PRICE": "10.90", "YEAR": "1985"}, {"TITLE": "Hide your heart", "ARTIST": "Bonnie Tyler", "COUNTRY": "UK", "COMPANY": "CBS Records", "PRICE": "9.90", "YEAR": "1988"}, {"TITLE": "Greatest Hits", "ARTIST": "Dolly Parton", "COUNTRY": "USA", "COMPANY": "RCA", "PRICE": "9.90", "YEAR": "1982"}, {"TITLE": "Still got the blues", "ARTIST": "Gary Moore", "COUNTRY": "UK", "COMPANY": "Virgin records", "PRICE": "10.20", "YEAR": "1990"}, {"TITLE": "Eros", "ARTIST": "Eros Ramazzotti", "COUNTRY": "EU", "COMPANY": "BMG", "PRICE": "9.90", "YEAR": "1997"}, {"TITLE": "One night only", "ARTIST": "Bee Gees", "COUNTRY": "UK", "COMPANY": "Polydor", "PRICE": "10.90", "YEAR": "1998"}, {"TITLE": "Sylvias Mother", "ARTIST": "Dr.Hook", "COUNTRY": "UK", "COMPANY": "CBS", "PRICE": "8.10", "YEAR": "1973"}, {"TITLE": "Maggie May", "ARTIST": "Rod Stewart", "COUNTRY": "UK", "COMPANY": "Pickwick", "PRICE": "8.50", "YEAR": "1990"}, {"TITLE": "Romanza", "ARTIST": "Andrea Bocelli", "COUNTRY": "EU", "COMPANY": "Polydor", "PRICE": "10.80", "YEAR": "1996"}, {"TITLE": "When a man loves a woman", "ARTIST": "Percy Sledge", "COUNTRY": "USA", "COMPANY": "Atlantic", "PRICE": "8.70", "YEAR": "1987"}, {"TITLE": "Black angel", "ARTIST": "Savage Rose", "COUNTRY": "EU", "COMPANY": "Mega", "PRICE": "10.90", "YEAR": "1995"}, {"TITLE": "1999 Grammy Nominees", "ARTIST": "Many", "COUNTRY": "USA", "COMPANY": "Grammy", "PRICE": "10.20", "YEAR": "1999"}, {"TITLE": "For the good times", "ARTIST": "Kenny Rogers", "COUNTRY": "UK", "COMPANY": "Mucik Master", "PRICE": "8.70", "YEAR": "1995"}, {"TITLE": "Big Willie style", "ARTIST": "Will Smith", "COUNTRY": "USA", "COMPANY": "Columbia", "PRICE": "9.90", "YEAR": "1997"}, {"TITLE": "Tupelo Honey", "ARTIST": "Van Morrison", "COUNTRY": "UK", "COMPANY": "Polydor", "PRICE": "8.20", "YEAR": "1971"}, {"TITLE": "Soulsville", "ARTIST": "Jorn Hoel", "COUNTRY": "Norway", "COMPANY": "WEA", "PRICE": "7.90", "YEAR": "1996"}, {"TITLE": "The very best of", "ARTIST": "Cat Stevens", "COUNTRY": "UK", "COMPANY": "Island", "PRICE": "8.90", "YEAR": "1990"}, {"TITLE": "Stop", "ARTIST": "Sam Brown", "COUNTRY": "UK", "COMPANY": "A and M", "PRICE": "8.90", "YEAR": "1988"}, {"TITLE": "Bridge of Spies", "ARTIST": "T'Pau", "COUNTRY": "UK", "COMPANY": "Siren", "PRICE": "7.90", "YEAR": "1987"}, {"TITLE": "Private Dancer", "ARTIST": "Tina Turner", "COUNTRY": "UK", "COMPANY": "Capitol", "PRICE": "8.90", "YEAR": "1983"}, {"TITLE": "Midt om natten", "ARTIST": "Kim Larsen", "COUNTRY": "EU", "COMPANY": "Medley", "PRICE": "7.80", "YEAR": "1983"}, {"TITLE": "Pavarotti Gala Concert", "ARTIST": "Luciano Pavarotti", "COUNTRY": "UK", "COMPANY": "DECCA", "PRICE": "9.90", "YEAR": "1991"}, {"TITLE": "The dock of the bay", "ARTIST": "Otis Redding", "COUNTRY": "USA", "COMPANY": "Stax Records", "PRICE": "7.90", "YEAR": "1968"}, {"TITLE": "Picture book", "ARTIST": "Simply Red", "COUNTRY": "EU", "COMPANY": "Elektra", "PRICE": "7.20", "YEAR": "1985"}, {"TITLE": "Red", "ARTIST": "The Communards", "COUNTRY": "UK", "COMPANY": "London", "PRICE": "7.80", "YEAR": "1987"}, {"TITLE": "Unchain my heart", "ARTIST": "Joe Cocker", "COUNTRY": "USA", "COMPANY": "EMI", "PRICE": "8.20", "YEAR": "1987"}]}} diff --git a/tests/fixtures/generic/xml-cd_catalog.xml b/tests/fixtures/generic/xml-cd_catalog.xml new file mode 100644 index 00000000..de15a6a5 --- /dev/null +++ b/tests/fixtures/generic/xml-cd_catalog.xml @@ -0,0 +1,211 @@ + + + + Empire Burlesque + Bob Dylan + USA + Columbia + 10.90 + 1985 + + + Hide your heart + Bonnie Tyler + UK + CBS Records + 9.90 + 1988 + + + Greatest Hits + Dolly Parton + USA + RCA + 9.90 + 1982 + + + Still got the blues + Gary Moore + UK + Virgin records + 10.20 + 1990 + + + Eros + Eros Ramazzotti + EU + BMG + 9.90 + 1997 + + + One night only + Bee Gees + UK + Polydor + 10.90 + 1998 + + + Sylvias Mother + Dr.Hook + UK + CBS + 8.10 + 1973 + + + Maggie May + Rod Stewart + UK + Pickwick + 8.50 + 1990 + + + Romanza + Andrea Bocelli + EU + Polydor + 10.80 + 1996 + + + When a man loves a woman + Percy Sledge + USA + Atlantic + 8.70 + 1987 + + + Black angel + Savage Rose + EU + Mega + 10.90 + 1995 + + + 1999 Grammy Nominees + Many + USA + Grammy + 10.20 + 1999 + + + For the good times + Kenny Rogers + UK + Mucik Master + 8.70 + 1995 + + + Big Willie style + Will Smith + USA + Columbia + 9.90 + 1997 + + + Tupelo Honey + Van Morrison + UK + Polydor + 8.20 + 1971 + + + Soulsville + Jorn Hoel + Norway + WEA + 7.90 + 1996 + + + The very best of + Cat Stevens + UK + Island + 8.90 + 1990 + + + Stop + Sam Brown + UK + A and M + 8.90 + 1988 + + + Bridge of Spies + T'Pau + UK + Siren + 7.90 + 1987 + + + Private Dancer + Tina Turner + UK + Capitol + 8.90 + 1983 + + + Midt om natten + Kim Larsen + EU + Medley + 7.80 + 1983 + + + Pavarotti Gala Concert + Luciano Pavarotti + UK + DECCA + 9.90 + 1991 + + + The dock of the bay + Otis Redding + USA + Stax Records + 7.90 + 1968 + + + Picture book + Simply Red + EU + Elektra + 7.20 + 1985 + + + Red + The Communards + UK + London + 7.80 + 1987 + + + Unchain my heart + Joe Cocker + USA + EMI + 8.20 + 1987 + + diff --git a/tests/fixtures/generic/xml-foodmenu.json b/tests/fixtures/generic/xml-foodmenu.json new file mode 100644 index 00000000..49216a65 --- /dev/null +++ b/tests/fixtures/generic/xml-foodmenu.json @@ -0,0 +1 @@ +{"breakfast_menu": {"food": [{"name": "Belgian Waffles", "price": "$5.95", "description": "Two of our famous Belgian Waffles with plenty of real maple syrup", "calories": "650"}, {"name": "Strawberry Belgian Waffles", "price": "$7.95", "description": "Light Belgian waffles covered with strawberries and whipped cream", "calories": "900"}, {"name": "Berry-Berry Belgian Waffles", "price": "$8.95", "description": "Light Belgian waffles covered with an assortment of fresh berries and whipped cream", "calories": "900"}, {"name": "French Toast", "price": "$4.50", "description": "Thick slices made from our homemade sourdough bread", "calories": "600"}, {"name": "Homestyle Breakfast", "price": "$6.95", "description": "Two eggs, bacon or sausage, toast, and our ever-popular hash browns", "calories": "950"}]}} diff --git a/tests/fixtures/generic/xml-foodmenu.xml b/tests/fixtures/generic/xml-foodmenu.xml new file mode 100644 index 00000000..d4db769c --- /dev/null +++ b/tests/fixtures/generic/xml-foodmenu.xml @@ -0,0 +1,33 @@ + + + + Belgian Waffles + $5.95 + Two of our famous Belgian Waffles with plenty of real maple syrup + 650 + + + Strawberry Belgian Waffles + $7.95 + Light Belgian waffles covered with strawberries and whipped cream + 900 + + + Berry-Berry Belgian Waffles + $8.95 + Light Belgian waffles covered with an assortment of fresh berries and whipped cream + 900 + + + French Toast + $4.50 + Thick slices made from our homemade sourdough bread + 600 + + + Homestyle Breakfast + $6.95 + Two eggs, bacon or sausage, toast, and our ever-popular hash browns + 950 + + diff --git a/tests/fixtures/generic/yaml-istio-sc.json b/tests/fixtures/generic/yaml-istio-sc.json new file mode 100644 index 00000000..206f88d8 --- /dev/null +++ b/tests/fixtures/generic/yaml-istio-sc.json @@ -0,0 +1 @@ +[{"apiVersion": "networking.istio.io/v1alpha3", "kind": "Sidecar", "metadata": {"name": "sidecar-config", "namespace": "default", "testboolean": true}, "spec": {"ingress": [{"port": {"number": 8080, "protocol": "HTTP", "name": "waf"}, "defaultEndpoint": "127.0.0.1:80", "captureMode": "IPTABLES"}], "egress": [{"hosts": ["*/*"]}]}}] diff --git a/tests/fixtures/generic/yaml-istio-sc.yaml b/tests/fixtures/generic/yaml-istio-sc.yaml new file mode 100644 index 00000000..cb148e5f --- /dev/null +++ b/tests/fixtures/generic/yaml-istio-sc.yaml @@ -0,0 +1,17 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: Sidecar +metadata: + name: sidecar-config + namespace: default + testboolean: true +spec: + ingress: + - port: + number: 8080 + protocol: HTTP + name: waf + defaultEndpoint: 127.0.0.1:80 + captureMode: IPTABLES + egress: + - hosts: + - "*/*" diff --git a/tests/fixtures/generic/yaml-istio-sidecar.json b/tests/fixtures/generic/yaml-istio-sidecar.json new file mode 100644 index 00000000..e7ebd1b8 --- /dev/null +++ b/tests/fixtures/generic/yaml-istio-sidecar.json @@ -0,0 +1 @@ +[{"apiVersion": "v1", "kind": "ServiceAccount", "metadata": {"name": "www", "testboolean": true}}, {"apiVersion": "v1", "kind": "ServiceAccount", "metadata": {"name": "db", "testboolean": false}}, {"apiVersion": "v1", "kind": "ServiceAccount", "metadata": {"name": "auth"}}, {"apiVersion": "apps/v1", "kind": "Deployment", "metadata": {"name": "www"}, "spec": {"replicas": 3, "selector": {"matchLabels": {"app": "www"}}, "template": {"metadata": {"labels": {"app": "www", "version": "v1.0"}}, "spec": {"serviceAccountName": "www", "containers": [{"name": "modsecurity", "image": "owasp/modsecurity-crs:v3.2-modsec2-apache", "ports": [{"containerPort": 80}], "env": [{"name": "SETPROXY", "value": "True"}, {"name": "PROXYLOCATION", "value": "http://127.0.0.1:8080/"}]}, {"name": "microsimserver", "image": "kellybrazil/microsimserver", "ports": [{"containerPort": 8080}], "env": [{"name": "STATS_PORT", "value": "5000"}]}, {"name": "microsimclient", "image": "kellybrazil/microsimclient", "env": [{"name": "STATS_PORT", "value": "5001"}, {"name": "REQUEST_URLS", "value": "http://auth.default.svc.cluster.local:8080/,http://db.default.svc.cluster.local:8080/"}, {"name": "SEND_SQLI", "value": "True"}]}]}}}}, {"apiVersion": "apps/v1", "kind": "Deployment", "metadata": {"name": "auth"}, "spec": {"replicas": 3, "selector": {"matchLabels": {"app": "auth"}}, "template": {"metadata": {"labels": {"app": "auth", "version": "v1.0"}}, "spec": {"serviceAccountName": "auth", "containers": [{"name": "modsecurity", "image": "owasp/modsecurity-crs:v3.2-modsec2-apache", "ports": [{"containerPort": 80}], "env": [{"name": "SETPROXY", "value": "True"}, {"name": "PROXYLOCATION", "value": "http://127.0.0.1:8080/"}]}, {"name": "microsimserver", "image": "kellybrazil/microsimserver", "ports": [{"containerPort": 8080}], "env": [{"name": "STATS_PORT", "value": "5000"}]}]}}}}, {"apiVersion": "apps/v1", "kind": "Deployment", "metadata": {"name": "db"}, "spec": {"replicas": 3, "selector": {"matchLabels": {"app": "db"}}, "template": {"metadata": {"labels": {"app": "db", "version": "v1.0"}}, "spec": {"serviceAccountName": "db", "containers": [{"name": "modsecurity", "image": "owasp/modsecurity-crs:v3.2-modsec2-apache", "ports": [{"containerPort": 80}], "env": [{"name": "SETPROXY", "value": "True"}, {"name": "PROXYLOCATION", "value": "http://127.0.0.1:8080/"}]}, {"name": "microsimserver", "image": "kellybrazil/microsimserver", "ports": [{"containerPort": 8080}], "env": [{"name": "STATS_PORT", "value": "5000"}]}]}}}}, {"apiVersion": "v1", "kind": "Service", "metadata": {"labels": {"app": "www"}, "name": "www"}, "spec": {"ports": [{"port": 8080, "targetPort": 80, "name": "http"}], "selector": {"app": "www"}, "sessionAffinity": "None"}}, {"apiVersion": "v1", "kind": "Service", "metadata": {"labels": {"app": "auth"}, "name": "auth"}, "spec": {"ports": [{"port": 8080, "targetPort": 80, "name": "http"}], "selector": {"app": "auth"}, "sessionAffinity": "None"}}, {"apiVersion": "v1", "kind": "Service", "metadata": {"labels": {"app": "db"}, "name": "db"}, "spec": {"ports": [{"port": 8080, "targetPort": 80, "name": "http"}], "selector": {"app": "db"}, "sessionAffinity": "None"}}] diff --git a/tests/fixtures/generic/yaml-istio-sidecar.yaml b/tests/fixtures/generic/yaml-istio-sidecar.yaml new file mode 100644 index 00000000..9248ad14 --- /dev/null +++ b/tests/fixtures/generic/yaml-istio-sidecar.yaml @@ -0,0 +1,174 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: www + testboolean: true +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: db + testboolean: false +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: auth +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: www +spec: + replicas: 3 + selector: + matchLabels: + app: www + template: + metadata: + labels: + app: www + version: v1.0 # add version + spec: + serviceAccountName: www # add serviceAccountName + containers: + - name: modsecurity + image: owasp/modsecurity-crs:v3.2-modsec2-apache + ports: + - containerPort: 80 + env: + - name: SETPROXY + value: "True" + - name: PROXYLOCATION + value: "http://127.0.0.1:8080/" + - name: microsimserver + image: kellybrazil/microsimserver + ports: + - containerPort: 8080 # add microsimserver port + env: + - name: STATS_PORT + value: "5000" + - name: microsimclient + image: kellybrazil/microsimclient + env: + - name: STATS_PORT + value: "5001" + - name: REQUEST_URLS + value: "http://auth.default.svc.cluster.local:8080/,http://db.default.svc.cluster.local:8080/" + - name: SEND_SQLI + value: "True" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: auth +spec: + replicas: 3 + selector: + matchLabels: + app: auth + template: + metadata: + labels: + app: auth + version: v1.0 # add version + spec: + serviceAccountName: auth # add serviceAccountName + containers: + - name: modsecurity + image: owasp/modsecurity-crs:v3.2-modsec2-apache + ports: + - containerPort: 80 + env: + - name: SETPROXY + value: "True" + - name: PROXYLOCATION + value: "http://127.0.0.1:8080/" + - name: microsimserver + image: kellybrazil/microsimserver + ports: + - containerPort: 8080 # add microsimserver port + env: + - name: STATS_PORT + value: "5000" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: db +spec: + replicas: 3 + selector: + matchLabels: + app: db + template: + metadata: + labels: + app: db + version: v1.0 # add version + spec: + serviceAccountName: db # add serviceAccountName + containers: + - name: modsecurity + image: owasp/modsecurity-crs:v3.2-modsec2-apache + ports: + - containerPort: 80 + env: + - name: SETPROXY + value: "True" + - name: PROXYLOCATION + value: "http://127.0.0.1:8080/" + - name: microsimserver + image: kellybrazil/microsimserver + ports: + - containerPort: 8080 # add microsimserver port + env: + - name: STATS_PORT + value: "5000" +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: www + name: www +spec: + # externalTrafficPolicy: Local # remove externalTrafficPolicy + ports: + - port: 8080 + targetPort: 80 + name: http # add port name + selector: + app: www + sessionAffinity: None + # type: LoadBalancer # remove LoadBalancer type +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: auth + name: auth +spec: + ports: + - port: 8080 + targetPort: 80 + name: http # add port name + selector: + app: auth + sessionAffinity: None +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: db + name: db +spec: + ports: + - port: 8080 + targetPort: 80 + name: http # add port name + selector: + app: db + sessionAffinity: None \ No newline at end of file diff --git a/tests/fixtures/osx-10.14.6/id.json b/tests/fixtures/osx-10.14.6/id.json new file mode 100644 index 00000000..ac367902 --- /dev/null +++ b/tests/fixtures/osx-10.14.6/id.json @@ -0,0 +1 @@ +{"uid": {"id": 501, "name": "kbrazil"}, "gid": {"id": 20, "name": "staff"}, "groups": [{"id": 20, "name": "staff"}, {"id": 501, "name": "access_bpf"}, {"id": 12, "name": "everyone"}, {"id": 61, "name": "localaccounts"}, {"id": 79, "name": "_appserverusr"}, {"id": 80, "name": "admin"}, {"id": 81, "name": "_appserveradm"}, {"id": 98, "name": "_lpadmin"}, {"id": 703, "name": "com.apple.sharepoint.group.3"}, {"id": 701, "name": "com.apple.sharepoint.group.1"}, {"id": 702, "name": "com.apple.sharepoint.group.2"}, {"id": 33, "name": "_appstore"}, {"id": 100, "name": "_lpoperator"}, {"id": 204, "name": "_developer"}, {"id": 250, "name": "_analyticsusers"}, {"id": 395, "name": "com.apple.access_ftp"}, {"id": 398, "name": "com.apple.access_screensharing"}]} diff --git a/tests/fixtures/osx-10.14.6/id.out b/tests/fixtures/osx-10.14.6/id.out new file mode 100644 index 00000000..86435954 --- /dev/null +++ b/tests/fixtures/osx-10.14.6/id.out @@ -0,0 +1 @@ +uid=501(kbrazil) gid=20(staff) groups=20(staff),501(access_bpf),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),703(com.apple.sharepoint.group.3),701(com.apple.sharepoint.group.1),702(com.apple.sharepoint.group.2),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing) diff --git a/tests/fixtures/ubuntu-18.04/crontab-u.json b/tests/fixtures/ubuntu-18.04/crontab-u.json new file mode 100644 index 00000000..bfbab519 --- /dev/null +++ b/tests/fixtures/ubuntu-18.04/crontab-u.json @@ -0,0 +1 @@ +{"variables": [{"name": "PATH", "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"}, {"name": "SHELL", "value": "/bin/sh"}], "schedule": [{"minute": ["17"], "hour": ["*"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "user": "root", "command": "cd / && run-parts --report /etc/cron.hourly"}, {"minute": ["25"], "hour": ["6"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "user": "root", "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"}, {"minute": ["47"], "hour": ["6"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["7"], "user": "root", "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"}, {"minute": ["52"], "hour": ["6"], "day_of_month": ["1"], "month": ["*"], "day_of_week": ["*"], "user": "root", "command": "test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"}]} diff --git a/tests/fixtures/ubuntu-18.04/crontab.out b/tests/fixtures/ubuntu-18.04/crontab-u.out similarity index 100% rename from tests/fixtures/ubuntu-18.04/crontab.out rename to tests/fixtures/ubuntu-18.04/crontab-u.out diff --git a/tests/fixtures/ubuntu-18.04/crontab.json b/tests/fixtures/ubuntu-18.04/crontab.json deleted file mode 100644 index 1f2b5740..00000000 --- a/tests/fixtures/ubuntu-18.04/crontab.json +++ /dev/null @@ -1 +0,0 @@ -{"variables": [{"name": "PATH", "value": "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"}, {"name": "SHELL", "value": "/bin/sh"}], "schedule": [{"minute": ["25"], "hour": ["6"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["*"], "command": "root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )"}, {"minute": ["47"], "hour": ["6"], "day_of_month": ["*"], "month": ["*"], "day_of_week": ["7"], "command": "root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )"}, {"minute": ["52"], "hour": ["6"], "day_of_month": ["1"], "month": ["*"], "day_of_week": ["*"], "command": "root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )"}]} diff --git a/tests/fixtures/ubuntu-18.04/history.json b/tests/fixtures/ubuntu-18.04/history.json index 5dd7b8c2..00928365 100644 --- a/tests/fixtures/ubuntu-18.04/history.json +++ b/tests/fixtures/ubuntu-18.04/history.json @@ -1 +1 @@ -[{"line": "1", "command": "ls"}, {"line": "2", "command": "top"}, {"line": "3", "command": "cd /etc/systemd/system/"}, {"line": "4", "command": "ls"}, {"line": "5", "command": "docker ps"}, {"line": "6", "command": "sudo su"}, {"line": "7", "command": "sudo su -"}, {"line": "8", "command": "vi resizeterm.sh"}, {"line": "9", "command": "chmod +x resizeterm.sh "}, {"line": "10", "command": "."}, {"line": "11", "command": "clear"}, {"line": "12", "command": "./resizeterm.sh "}, {"line": "13", "command": "ls"}, {"line": "14", "command": "cd .."}, {"line": "15", "command": "ls"}, {"line": "16", "command": "cd .."}, {"line": "17", "command": "ls"}, {"line": "18", "command": "cd root/"}, {"line": "19", "command": "ls"}, {"line": "20", "command": "sudo su -"}, {"line": "21", "command": "snap"}, {"line": "22", "command": "snap update"}, {"line": "23", "command": "snap help"}, {"line": "24", "command": "snap help --all"}, {"line": "25", "command": "top"}, {"line": "26", "command": "vi"}, {"line": "27", "command": "ls"}, {"line": "28", "command": "./resizeterm.sh "}, {"line": "29", "command": "top"}, {"line": "30", "command": "ls"}, {"line": "31", "command": "exit"}, {"line": "32", "command": "./resizeterm.sh "}, {"line": "33", "command": "docker ps"}, {"line": "34", "command": "sudo su - "}, {"line": "35", "command": "ls"}, {"line": "36", "command": "top"}, {"line": "37", "command": "vi trafficgen.sh"}, {"line": "38", "command": "chmod +x trafficgen.sh "}, {"line": "39", "command": "./trafficgen.sh "}, {"line": "40", "command": "sudo su -"}, {"line": "41", "command": "ls"}, {"line": "42", "command": "nmap"}, {"line": "43", "command": "./trafficgen.sh "}, {"line": "44", "command": "nmap --help"}, {"line": "45", "command": "./trafficgen.sh "}, {"line": "46", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": "47", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 11"}, {"line": "48", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 12"}, {"line": "49", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 13"}, {"line": "50", "command": "ip address"}, {"line": "51", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": "52", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 9"}, {"line": "53", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": "54", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 11"}, {"line": "55", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 12"}, {"line": "56", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 13"}, {"line": "57", "command": "ifconfig ens33 | grep \"inet \" | cut -d \"/\""}, {"line": "58", "command": "ifconfig ens33 | grep \"inet \" | cut -d \"/\" -f 1"}, {"line": "59", "command": "ifconfig ens33 | grep \"inet \" | cut -d \"\\/\" -f 1"}, {"line": "60", "command": "ifconfig ens33 | grep \"inet \" | tr \"/\" \" \""}, {"line": "61", "command": "ifconfig -a ens33 | grep \"inet \" | tr \"/\" \" \""}, {"line": "62", "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": "63", "command": "ifconfig ens33 | grep \"inet \""}, {"line": "64", "command": "ifconfig ens33 -a | grep \"inet \""}, {"line": "65", "command": "ifconfig -a ens33 | grep \"inet \""}, {"line": "66", "command": "ifconfig -v ens33 | grep \"inet \""}, {"line": "67", "command": "ifconfig ens33 | grep \"inet \""}, {"line": "68", "command": "ip address"}, {"line": "69", "command": "rm trafficgen.sh "}, {"line": "70", "command": "vi trafficgen.sh"}, {"line": "71", "command": "chmod +x trafficgen.sh "}, {"line": "72", "command": "./trafficgen.sh "}, {"line": "73", "command": "vi trafficgen.sh "}, {"line": "74", "command": "./trafficgen.sh "}, {"line": "75", "command": "sudo su -"}, {"line": "76", "command": "snap update"}, {"line": "77", "command": "ls"}, {"line": "78", "command": "./trafficgen.sh "}, {"line": "79", "command": "sudo su -"}, {"line": "80", "command": "nmap"}, {"line": "81", "command": "nmap 192.168.71.10"}, {"line": "82", "command": "ls"}, {"line": "83", "command": "./resizeterm.sh "}, {"line": "84", "command": "./trafficgen.sh "}, {"line": "85", "command": "sudo su"}, {"line": "86", "command": "docker ps"}, {"line": "87", "command": "sudo docker ps"}, {"line": "88", "command": "systemctl reboot"}, {"line": "89", "command": "sudo su"}, {"line": "90", "command": "docker ps"}, {"line": "91", "command": "sudo su"}, {"line": "92", "command": "pip"}, {"line": "93", "command": "python3"}, {"line": "94", "command": "sudo apt update"}, {"line": "95", "command": "sudo apt upgrade"}, {"line": "96", "command": "apt list --upgradable"}, {"line": "97", "command": "sudo apt update all"}, {"line": "98", "command": "sudo apt update"}, {"line": "99", "command": "sudo apt-get upgrade"}, {"line": "100", "command": "ps"}, {"line": "101", "command": "ps -ef"}, {"line": "102", "command": "top"}, {"line": "103", "command": "pip3"}, {"line": "104", "command": "sudo apt install python3-pip"}, {"line": "105", "command": "./resizeterm.sh "}, {"line": "106", "command": "pip3 install jc"}, {"line": "107", "command": "jc"}, {"line": "108", "command": "which jc"}, {"line": "109", "command": "pip3 install --user jc"}, {"line": "110", "command": "jc"}, {"line": "111", "command": "sudo pip3 install jc"}, {"line": "112", "command": "jc"}, {"line": "113", "command": "which jc"}, {"line": "114", "command": "exit"}, {"line": "115", "command": "jc"}, {"line": "116", "command": "ifconfig | jc --ifconfig"}, {"line": "117", "command": "ifconfig | jc --ifconfig -p"}, {"line": "118", "command": "ls -l | jc --ls"}, {"line": "119", "command": "ls -l | jc --ls -p"}, {"line": "120", "command": "ls -l /bin | jc --ls -p"}, {"line": "121", "command": "netstat"}, {"line": "122", "command": "netstat | jc --netstat -p"}, {"line": "123", "command": "netstat -l | jc --netstat -p"}, {"line": "124", "command": "netstat -nl | jc --netstat -p"}, {"line": "125", "command": "netstat -n | jc --netstat -p"}, {"line": "126", "command": "netstat -n | jc --netstat | jq ."}, {"line": "127", "command": "sudo apt-get jq"}, {"line": "128", "command": "sudo apt-get install jq"}, {"line": "129", "command": "netstat -n | jc --netstat | jq ."}, {"line": "130", "command": "netstat -lnp | jc --netstat | jq ."}, {"line": "131", "command": "netstat -lp | jc --netstat | jq ."}, {"line": "132", "command": "netstat -l | jc --netstat | jq ."}, {"line": "133", "command": "netstat -lnp"}, {"line": "134", "command": "netstat -ln"}, {"line": "135", "command": "netstat"}, {"line": "136", "command": "netstat -l | jc --netstat | jq ."}, {"line": "137", "command": "curl"}, {"line": "138", "command": "netstat -p"}, {"line": "139", "command": "sudo netstat -p"}, {"line": "140", "command": "apt update & sudo netstat"}, {"line": "141", "command": "apt update & sleep 1; sudo netstat"}, {"line": "142", "command": "sudo apt update & sleep 1; sudo netstat"}, {"line": "143", "command": "sudo apt update & sleep 2; sudo netstat -p"}, {"line": "144", "command": "sudo apt update & sleep 1; sudo netstat -p"}, {"line": "145", "command": "sudo netstat -lp | jc --netstat -p"}, {"line": "146", "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": "147", "command": "netstat -lp | jc --netstat | jq ."}, {"line": "148", "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": "149", "command": "sudo netstat -lpn | jc --netstat | jq ."}, {"line": "150", "command": "sudo netstat -lpnw | jc --netstat | jq ."}, {"line": "151", "command": "man netstat"}, {"line": "152", "command": "./resizeterm.sh "}, {"line": "153", "command": "man netstat "}, {"line": "154", "command": "sudo netstat -lpnW | jc --netstat | jq ."}, {"line": "155", "command": "sudo netstat -lpn -W | jc --netstat | jq ."}, {"line": "156", "command": "man netstat"}, {"line": "157", "command": "sudo netstat -lp -W | jc --netstat | jq ."}, {"line": "158", "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": "159", "command": "ls -l /usr/bin | jc --ls | jq .[].'select(.bytes > 50000000)'"}, {"line": "160", "command": "ls -l /usr/bin | jc --ls | jq .[]'select(.bytes > 50000000)'"}, {"line": "161", "command": "ls -l /usr/bin | jc --ls | jq [].'select(.bytes > 50000000)'"}, {"line": "162", "command": "ls -l /usr/bin | jc --ls | jq [.'select(.bytes > 50000000)]'"}, {"line": "163", "command": "ls -l /usr/bin | jc --ls | jq .'select(.bytes > 50000000)'"}, {"line": "164", "command": "ls -l /usr/bin | jc --ls | jq [].'select(.bytes > 50000000)'"}, {"line": "165", "command": "ls -l /usr/bin | jc --ls | jq .[].'select(.bytes > 50000000)'"}, {"line": "166", "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": "167", "command": "netstat | jc --netstat"}, {"line": "168", "command": "netstat -l | jc --netstat"}, {"line": "169", "command": "netstat -l | jc --netstat | jq ."}, {"line": "170", "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": "171", "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": "172", "command": "ls -l /usr/bin | jc --ls | jq .[] 'select(.bytes > 50000000)'"}, {"line": "173", "command": "ls -l /usr/bin | jc --ls | jq .[]. 'select(.bytes > 50000000)'"}, {"line": "174", "command": "ls -l /usr/bin | jc --ls | jq .[]'"}, {"line": "175", "command": "ls -l /usr/bin | jc --ls | jq .[].'"}, {"line": "176", "command": "ls -l /usr/bin | jc --ls | jq .[]"}, {"line": "177", "command": "ls -l /usr/bin | jc --ls | jq .[]."}, {"line": "178", "command": "ls -l /usr/bin | jc --ls | jq '.[] select(.bytes > 50000000)'"}, {"line": "179", "command": "ls -l /usr/bin | jc --ls | jq '.[]. select(.bytes > 50000000)'"}, {"line": "180", "command": "ls -l /usr/bin | jc --ls | jq '.[] select(.bytes > 50000000)'"}, {"line": "181", "command": "ls -l /usr/bin | jc --ls | jq '.[] . select(.bytes > 50000000)'"}, {"line": "182", "command": "ls -l /usr/bin | jc --ls | jq '[]. select(.bytes > 50000000)'"}, {"line": "183", "command": "ls -l /usr/bin | jc --ls | jq '[].select(.bytes > 50000000)'"}, {"line": "184", "command": "ls -l /usr/bin | jc --ls | jq '.[].select(.bytes > 50000000)'"}, {"line": "185", "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": "186", "command": "ls"}, {"line": "187", "command": "mkdir git"}, {"line": "188", "command": "cd git/"}, {"line": "189", "command": "ls"}, {"line": "190", "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": "191", "command": "cd jc/"}, {"line": "192", "command": "ls"}, {"line": "193", "command": "cat README.md "}, {"line": "194", "command": "cd .."}, {"line": "195", "command": "ls"}, {"line": "196", "command": "rm -rf jc/"}, {"line": "197", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "198", "command": "ls"}, {"line": "199", "command": "cd jc/"}, {"line": "200", "command": "ls"}, {"line": "201", "command": "cat README.md "}, {"line": "202", "command": "pip3 list"}, {"line": "203", "command": "pip3 unistall jc"}, {"line": "204", "command": "pip3 uninstall jc"}, {"line": "205", "command": "jc"}, {"line": "206", "command": "ls"}, {"line": "207", "command": "pip3 install --upgrade -e ."}, {"line": "208", "command": "jc"}, {"line": "209", "command": "ls"}, {"line": "210", "command": "cd jc"}, {"line": "211", "command": "ls"}, {"line": "212", "command": "cd parsers/"}, {"line": "213", "command": "ls"}, {"line": "214", "command": "netstat -lp | jc --netstat"}, {"line": "215", "command": "ls"}, {"line": "216", "command": "netstat -p | jc --netstat"}, {"line": "217", "command": "netstat -lp | jc --netstat"}, {"line": "218", "command": "rm netstat.py "}, {"line": "219", "command": "vi netstat.py"}, {"line": "220", "command": "netstat -lp | jc --netstat"}, {"line": "221", "command": "netstat -l | jc --netstat"}, {"line": "222", "command": "netstat -l | jc --netstat -p"}, {"line": "223", "command": "netstat -lp | jc --netstat -p"}, {"line": "224", "command": "netstat -lp"}, {"line": "225", "command": "sudo netstat -lp | jc --netstat -p"}, {"line": "226", "command": "rm netstat.py "}, {"line": "227", "command": "vi netstat.py"}, {"line": "228", "command": "sudo netstat -lp | jc --netstat -p"}, {"line": "229", "command": "netstat -lp | jc --netstat -p"}, {"line": "230", "command": "rm netstat.py "}, {"line": "231", "command": "vi netstat.py"}, {"line": "232", "command": "netstat -lp | jc --netstat -p"}, {"line": "233", "command": "sudo netstat -lp | jc --netstat -p"}, {"line": "234", "command": "sudo netstat -p | jc --netstat -p"}, {"line": "235", "command": "netstat -p | jc --netstat -p"}, {"line": "236", "command": "cd .."}, {"line": "237", "command": "cd ~"}, {"line": "238", "command": "ls"}, {"line": "239", "command": "cat trafficgen.sh "}, {"line": "240", "command": "mkdir tmp"}, {"line": "241", "command": "cd tmp"}, {"line": "242", "command": "history | grep clone"}, {"line": "243", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat | jc --netstat"}, {"line": "244", "command": "ls"}, {"line": "245", "command": "rm -rf jc/"}, {"line": "246", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat"}, {"line": "247", "command": "rm -rf jc/"}, {"line": "248", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat | jc --netstat"}, {"line": "249", "command": "rm -rf jc/"}, {"line": "250", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat"}, {"line": "251", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": "252", "command": "rm -rf jc/"}, {"line": "253", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": "254", "command": "rm -rf jc/"}, {"line": "255", "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": "256", "command": "netstat -l | jc --netstat -p"}, {"line": "257", "command": "netstat -ln | jc --netstat -p"}, {"line": "258", "command": "netstat -lnp | jc --netstat -p"}, {"line": "259", "command": "sudo netstat -lnp | jc --netstat -p"}, {"line": "260", "command": "history | grep clone"}, {"line": "261", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "262", "command": "ls"}, {"line": "263", "command": "ps -a"}, {"line": "264", "command": "ps -ef"}, {"line": "265", "command": "ps -axz"}, {"line": "266", "command": "ps -ax"}, {"line": "267", "command": "ps -axu"}, {"line": "268", "command": "cd ~/git/"}, {"line": "269", "command": "pip3 uninstall jc"}, {"line": "270", "command": "history | grep clone"}, {"line": "271", "command": "ls"}, {"line": "272", "command": "rm -rf jc/"}, {"line": "273", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "274", "command": "pip3 install --user -e ."}, {"line": "275", "command": "cd jc/"}, {"line": "276", "command": "pip3 install --user -e ."}, {"line": "277", "command": "jc"}, {"line": "278", "command": "ps | jc --ps"}, {"line": "279", "command": "ps | jc --ps -p"}, {"line": "280", "command": "ps -ef | jc --ps -p"}, {"line": "281", "command": "ps -ax | jc --ps -p"}, {"line": "282", "command": "ps -axu | jc --ps -p"}, {"line": "283", "command": "ps -axu | jc --ps | jq ."}, {"line": "284", "command": "ps -ef | jc --ps -p"}, {"line": "285", "command": "route"}, {"line": "286", "command": "route -n"}, {"line": "287", "command": "ls"}, {"line": "288", "command": "cd .."}, {"line": "289", "command": "pip3 uninstall jc"}, {"line": "290", "command": "ls"}, {"line": "291", "command": "rm -rf jc/"}, {"line": "292", "command": "history | grep clone"}, {"line": "293", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "294", "command": "ls"}, {"line": "295", "command": "cd jc/"}, {"line": "296", "command": "pip3 install --user -e ."}, {"line": "297", "command": "route | jc --route -p"}, {"line": "298", "command": "route -v | jc --route -p"}, {"line": "299", "command": "route | jc --route -p"}, {"line": "300", "command": "route -n | jc --route -p"}, {"line": "301", "command": "route -n | jc --route"}, {"line": "302", "command": "ls -l | jc --ls"}, {"line": "303", "command": "netstat -l | jc --ls"}, {"line": "304", "command": "netstat -l | jc --netstat"}, {"line": "305", "command": "netstat -l | jc"}, {"line": "306", "command": "ifconfig | jc --ifconfig"}, {"line": "307", "command": "route | jc --route"}, {"line": "308", "command": "ps -ef | jc --ps -p"}, {"line": "309", "command": "pip list"}, {"line": "310", "command": "pip3 list"}, {"line": "311", "command": "ls"}, {"line": "312", "command": "netstat | jc --netstat -p"}, {"line": "313", "command": "netstat -l | jc --netstat -p"}, {"line": "314", "command": "pip3 list"}, {"line": "315", "command": "cd jc/parsers/"}, {"line": "316", "command": "ls"}, {"line": "317", "command": "ls -l | jc --ls"}, {"line": "318", "command": "ls -l | jc --ls -p"}, {"line": "319", "command": "ls -l /var | jc --ls -p"}, {"line": "320", "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": "321", "command": "ls -l /usr/local/bin/"}, {"line": "322", "command": "ls -l /usr/local"}, {"line": "323", "command": "ls -l ~/.local/"}, {"line": "324", "command": "ls -l ~/.local/bin/"}, {"line": "325", "command": "ls -l ~/.local/lib"}, {"line": "326", "command": "ls -l ~/.local/lib/python3.6/"}, {"line": "327", "command": "ls -l ~/.local/lib/python3.6/site-packages/"}, {"line": "328", "command": "ls -l ~/.local/lib/python3.6/site-packages/ifconfigparser/"}, {"line": "329", "command": "ls -l ~/.local/lib/python3.6/site-packages/ifconfigparser/__pycache__/"}, {"line": "330", "command": "ls -l /"}, {"line": "331", "command": "ls -l / | jc --ls"}, {"line": "332", "command": "ls -l / | jc --ls -p"}, {"line": "333", "command": "rm ls.py "}, {"line": "334", "command": "vi ls.py"}, {"line": "335", "command": "ls -l / | jc --ls -p"}, {"line": "336", "command": "ls -l /"}, {"line": "337", "command": "rm ls.py "}, {"line": "338", "command": "vi ls.py"}, {"line": "339", "command": "ls -l / | jc --ls -p"}, {"line": "340", "command": "rm ls.py "}, {"line": "341", "command": "vi ls.py"}, {"line": "342", "command": "ls -l / | jc --ls -p"}, {"line": "343", "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": "344", "command": "rm ls.py "}, {"line": "345", "command": "vi ls.py"}, {"line": "346", "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": "347", "command": "ls -l / | jc --ls -p"}, {"line": "348", "command": "cd ~"}, {"line": "349", "command": "pip3 uninstall jc"}, {"line": "350", "command": "cd git/"}, {"line": "351", "command": "ls"}, {"line": "352", "command": "rm -rf jc/"}, {"line": "353", "command": "history | grep clone"}, {"line": "354", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "355", "command": "ls"}, {"line": "356", "command": "cd jc/"}, {"line": "357", "command": "pip3 install --user --upgrade -e ."}, {"line": "358", "command": "jc"}, {"line": "359", "command": "ls /usr/local/bin | jc --ls"}, {"line": "360", "command": "ls /usr/local/bin "}, {"line": "361", "command": "ls /usr/local/bin -l"}, {"line": "362", "command": "cd jc/parsers/"}, {"line": "363", "command": "ls"}, {"line": "364", "command": "rm ls.py "}, {"line": "365", "command": "vi ls.py"}, {"line": "366", "command": "ls /usr/local/bin "}, {"line": "367", "command": "ls /usr/local/bin | jc --ls"}, {"line": "368", "command": "ls -l /usr/local/bin | jc --ls"}, {"line": "369", "command": "ls -al /usr/local/bin | jc --ls"}, {"line": "370", "command": "ls -al /usr/local/bin | jc --ls -p"}, {"line": "371", "command": "cd .."}, {"line": "372", "command": "pip3 uninstall jc"}, {"line": "373", "command": "rm -rf jc/"}, {"line": "374", "command": "history | grep clone"}, {"line": "375", "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": "376", "command": "cd jc/"}, {"line": "377", "command": "pip3 install --user --upgrade -e ."}, {"line": "378", "command": "jc"}, {"line": "379", "command": "ls /usr/local/bin | jc --ls"}, {"line": "380", "command": "ls -l /usr/local/bin | jc --ls"}, {"line": "381", "command": "ls -al /usr/local/bin | jc --ls"}, {"line": "382", "command": "ls -al /usr/local/bin | jc --ls -p"}, {"line": "383", "command": "ps -ef | jc --ps"}, {"line": "384", "command": "ps -ef | jc --ps -p"}, {"line": "385", "command": "pip3 list"}, {"line": "386", "command": "ls"}, {"line": "387", "command": "./build-package.sh "}, {"line": "388", "command": "ls"}, {"line": "389", "command": "./pypi-upload.sh "}, {"line": "390", "command": "cd .."}, {"line": "391", "command": "ls"}, {"line": "392", "command": "pip3 uninstall jc"}, {"line": "393", "command": "rm -rf jc/"}, {"line": "394", "command": "pip3 install --user --upgrade jc"}, {"line": "395", "command": "pip3 list"}, {"line": "396", "command": "w"}, {"line": "397", "command": "w -f"}, {"line": "398", "command": "w | jc --route"}, {"line": "399", "command": "w | jc --route -p"}, {"line": "400", "command": "w -f | jc --route -p"}, {"line": "401", "command": "route"}, {"line": "402", "command": "uptime"}, {"line": "403", "command": "ls -l /bin | jc --ls -p"}, {"line": "404", "command": "lsof | jc --lsof -p"}, {"line": "405", "command": "sudo lsof | jc --lsof -p"}, {"line": "406", "command": "w | jc --w -p"}, {"line": "407", "command": "uptime | jc --uptime -p"}, {"line": "408", "command": "ls"}, {"line": "409", "command": "cd testfiles/"}, {"line": "410", "command": "ls"}, {"line": "411", "command": "rm tests.sh "}, {"line": "412", "command": "vi tests.sh"}, {"line": "413", "command": "chmod +x tests.sh "}, {"line": "414", "command": "./tests.sh "}, {"line": "415", "command": "ls"}, {"line": "416", "command": "cat iptables-filter.out "}, {"line": "417", "command": "cat iptables-filter-nv.out "}, {"line": "418", "command": "ls"}, {"line": "419", "command": "ls -al"}, {"line": "420", "command": "man history"}, {"line": "421", "command": "rm tests.sh "}, {"line": "422", "command": "vi tests.sh"}, {"line": "423", "command": "chmod +x tests.sh "}, {"line": "424", "command": "./tests.sh "}, {"line": "425", "command": "ls -al"}, {"line": "426", "command": "cat netstat.out "}, {"line": "427", "command": "ls"}, {"line": "428", "command": "cat w"}, {"line": "429", "command": "cat w.out "}, {"line": "430", "command": "cat uname-a.out "}, {"line": "431", "command": "rm tests.sh "}, {"line": "432", "command": "vi tests.sh"}, {"line": "433", "command": "chmod +x tests.sh "}, {"line": "434", "command": "./tests.sh "}, {"line": "435", "command": "ls -al"}, {"line": "436", "command": "cat iptables-filter.out "}, {"line": "437", "command": "uname"}, {"line": "438", "command": "uname -a"}, {"line": "439", "command": "cd /etc/"}, {"line": "440", "command": "ls"}, {"line": "441", "command": "uname -a"}, {"line": "442", "command": "ls"}, {"line": "443", "command": "cat debian_version "}, {"line": "444", "command": "lsb_release -a "}, {"line": "445", "command": "uname -a"}, {"line": "446", "command": "lsb_release "}, {"line": "447", "command": "lsb_release -a"}, {"line": "448", "command": "ifconfig"}, {"line": "449", "command": "cd ~"}, {"line": "450", "command": "cd testfiles/"}, {"line": "451", "command": "ls"}, {"line": "452", "command": "cat history.out "}, {"line": "453", "command": "history > history.out"}] +[{"line": 1, "command": "ls"}, {"line": 2, "command": "top"}, {"line": 3, "command": "cd /etc/systemd/system/"}, {"line": 4, "command": "ls"}, {"line": 5, "command": "docker ps"}, {"line": 6, "command": "sudo su"}, {"line": 7, "command": "sudo su -"}, {"line": 8, "command": "vi resizeterm.sh"}, {"line": 9, "command": "chmod +x resizeterm.sh "}, {"line": 10, "command": "."}, {"line": 11, "command": "clear"}, {"line": 12, "command": "./resizeterm.sh "}, {"line": 13, "command": "ls"}, {"line": 14, "command": "cd .."}, {"line": 15, "command": "ls"}, {"line": 16, "command": "cd .."}, {"line": 17, "command": "ls"}, {"line": 18, "command": "cd root/"}, {"line": 19, "command": "ls"}, {"line": 20, "command": "sudo su -"}, {"line": 21, "command": "snap"}, {"line": 22, "command": "snap update"}, {"line": 23, "command": "snap help"}, {"line": 24, "command": "snap help --all"}, {"line": 25, "command": "top"}, {"line": 26, "command": "vi"}, {"line": 27, "command": "ls"}, {"line": 28, "command": "./resizeterm.sh "}, {"line": 29, "command": "top"}, {"line": 30, "command": "ls"}, {"line": 31, "command": "exit"}, {"line": 32, "command": "./resizeterm.sh "}, {"line": 33, "command": "docker ps"}, {"line": 34, "command": "sudo su - "}, {"line": 35, "command": "ls"}, {"line": 36, "command": "top"}, {"line": 37, "command": "vi trafficgen.sh"}, {"line": 38, "command": "chmod +x trafficgen.sh "}, {"line": 39, "command": "./trafficgen.sh "}, {"line": 40, "command": "sudo su -"}, {"line": 41, "command": "ls"}, {"line": 42, "command": "nmap"}, {"line": 43, "command": "./trafficgen.sh "}, {"line": 44, "command": "nmap --help"}, {"line": 45, "command": "./trafficgen.sh "}, {"line": 46, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": 47, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 11"}, {"line": 48, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 12"}, {"line": 49, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 13"}, {"line": 50, "command": "ip address"}, {"line": 51, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": 52, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 9"}, {"line": 53, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": 54, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 11"}, {"line": 55, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 12"}, {"line": 56, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 13"}, {"line": 57, "command": "ifconfig ens33 | grep \"inet \" | cut -d \"/\""}, {"line": 58, "command": "ifconfig ens33 | grep \"inet \" | cut -d \"/\" -f 1"}, {"line": 59, "command": "ifconfig ens33 | grep \"inet \" | cut -d \"\\/\" -f 1"}, {"line": 60, "command": "ifconfig ens33 | grep \"inet \" | tr \"/\" \" \""}, {"line": 61, "command": "ifconfig -a ens33 | grep \"inet \" | tr \"/\" \" \""}, {"line": 62, "command": "ifconfig ens33 | grep \"inet \" | cut -d \" \" -f 10"}, {"line": 63, "command": "ifconfig ens33 | grep \"inet \""}, {"line": 64, "command": "ifconfig ens33 -a | grep \"inet \""}, {"line": 65, "command": "ifconfig -a ens33 | grep \"inet \""}, {"line": 66, "command": "ifconfig -v ens33 | grep \"inet \""}, {"line": 67, "command": "ifconfig ens33 | grep \"inet \""}, {"line": 68, "command": "ip address"}, {"line": 69, "command": "rm trafficgen.sh "}, {"line": 70, "command": "vi trafficgen.sh"}, {"line": 71, "command": "chmod +x trafficgen.sh "}, {"line": 72, "command": "./trafficgen.sh "}, {"line": 73, "command": "vi trafficgen.sh "}, {"line": 74, "command": "./trafficgen.sh "}, {"line": 75, "command": "sudo su -"}, {"line": 76, "command": "snap update"}, {"line": 77, "command": "ls"}, {"line": 78, "command": "./trafficgen.sh "}, {"line": 79, "command": "sudo su -"}, {"line": 80, "command": "nmap"}, {"line": 81, "command": "nmap 192.168.71.10"}, {"line": 82, "command": "ls"}, {"line": 83, "command": "./resizeterm.sh "}, {"line": 84, "command": "./trafficgen.sh "}, {"line": 85, "command": "sudo su"}, {"line": 86, "command": "docker ps"}, {"line": 87, "command": "sudo docker ps"}, {"line": 88, "command": "systemctl reboot"}, {"line": 89, "command": "sudo su"}, {"line": 90, "command": "docker ps"}, {"line": 91, "command": "sudo su"}, {"line": 92, "command": "pip"}, {"line": 93, "command": "python3"}, {"line": 94, "command": "sudo apt update"}, {"line": 95, "command": "sudo apt upgrade"}, {"line": 96, "command": "apt list --upgradable"}, {"line": 97, "command": "sudo apt update all"}, {"line": 98, "command": "sudo apt update"}, {"line": 99, "command": "sudo apt-get upgrade"}, {"line": 100, "command": "ps"}, {"line": 101, "command": "ps -ef"}, {"line": 102, "command": "top"}, {"line": 103, "command": "pip3"}, {"line": 104, "command": "sudo apt install python3-pip"}, {"line": 105, "command": "./resizeterm.sh "}, {"line": 106, "command": "pip3 install jc"}, {"line": 107, "command": "jc"}, {"line": 108, "command": "which jc"}, {"line": 109, "command": "pip3 install --user jc"}, {"line": 110, "command": "jc"}, {"line": 111, "command": "sudo pip3 install jc"}, {"line": 112, "command": "jc"}, {"line": 113, "command": "which jc"}, {"line": 114, "command": "exit"}, {"line": 115, "command": "jc"}, {"line": 116, "command": "ifconfig | jc --ifconfig"}, {"line": 117, "command": "ifconfig | jc --ifconfig -p"}, {"line": 118, "command": "ls -l | jc --ls"}, {"line": 119, "command": "ls -l | jc --ls -p"}, {"line": 120, "command": "ls -l /bin | jc --ls -p"}, {"line": 121, "command": "netstat"}, {"line": 122, "command": "netstat | jc --netstat -p"}, {"line": 123, "command": "netstat -l | jc --netstat -p"}, {"line": 124, "command": "netstat -nl | jc --netstat -p"}, {"line": 125, "command": "netstat -n | jc --netstat -p"}, {"line": 126, "command": "netstat -n | jc --netstat | jq ."}, {"line": 127, "command": "sudo apt-get jq"}, {"line": 128, "command": "sudo apt-get install jq"}, {"line": 129, "command": "netstat -n | jc --netstat | jq ."}, {"line": 130, "command": "netstat -lnp | jc --netstat | jq ."}, {"line": 131, "command": "netstat -lp | jc --netstat | jq ."}, {"line": 132, "command": "netstat -l | jc --netstat | jq ."}, {"line": 133, "command": "netstat -lnp"}, {"line": 134, "command": "netstat -ln"}, {"line": 135, "command": "netstat"}, {"line": 136, "command": "netstat -l | jc --netstat | jq ."}, {"line": 137, "command": "curl"}, {"line": 138, "command": "netstat -p"}, {"line": 139, "command": "sudo netstat -p"}, {"line": 140, "command": "apt update & sudo netstat"}, {"line": 141, "command": "apt update & sleep 1; sudo netstat"}, {"line": 142, "command": "sudo apt update & sleep 1; sudo netstat"}, {"line": 143, "command": "sudo apt update & sleep 2; sudo netstat -p"}, {"line": 144, "command": "sudo apt update & sleep 1; sudo netstat -p"}, {"line": 145, "command": "sudo netstat -lp | jc --netstat -p"}, {"line": 146, "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": 147, "command": "netstat -lp | jc --netstat | jq ."}, {"line": 148, "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": 149, "command": "sudo netstat -lpn | jc --netstat | jq ."}, {"line": 150, "command": "sudo netstat -lpnw | jc --netstat | jq ."}, {"line": 151, "command": "man netstat"}, {"line": 152, "command": "./resizeterm.sh "}, {"line": 153, "command": "man netstat "}, {"line": 154, "command": "sudo netstat -lpnW | jc --netstat | jq ."}, {"line": 155, "command": "sudo netstat -lpn -W | jc --netstat | jq ."}, {"line": 156, "command": "man netstat"}, {"line": 157, "command": "sudo netstat -lp -W | jc --netstat | jq ."}, {"line": 158, "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": 159, "command": "ls -l /usr/bin | jc --ls | jq .[].'select(.bytes > 50000000)'"}, {"line": 160, "command": "ls -l /usr/bin | jc --ls | jq .[]'select(.bytes > 50000000)'"}, {"line": 161, "command": "ls -l /usr/bin | jc --ls | jq [].'select(.bytes > 50000000)'"}, {"line": 162, "command": "ls -l /usr/bin | jc --ls | jq [.'select(.bytes > 50000000)]'"}, {"line": 163, "command": "ls -l /usr/bin | jc --ls | jq .'select(.bytes > 50000000)'"}, {"line": 164, "command": "ls -l /usr/bin | jc --ls | jq [].'select(.bytes > 50000000)'"}, {"line": 165, "command": "ls -l /usr/bin | jc --ls | jq .[].'select(.bytes > 50000000)'"}, {"line": 166, "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": 167, "command": "netstat | jc --netstat"}, {"line": 168, "command": "netstat -l | jc --netstat"}, {"line": 169, "command": "netstat -l | jc --netstat | jq ."}, {"line": 170, "command": "sudo netstat -lp | jc --netstat | jq ."}, {"line": 171, "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": 172, "command": "ls -l /usr/bin | jc --ls | jq .[] 'select(.bytes > 50000000)'"}, {"line": 173, "command": "ls -l /usr/bin | jc --ls | jq .[]. 'select(.bytes > 50000000)'"}, {"line": 174, "command": "ls -l /usr/bin | jc --ls | jq .[]'"}, {"line": 175, "command": "ls -l /usr/bin | jc --ls | jq .[].'"}, {"line": 176, "command": "ls -l /usr/bin | jc --ls | jq .[]"}, {"line": 177, "command": "ls -l /usr/bin | jc --ls | jq .[]."}, {"line": 178, "command": "ls -l /usr/bin | jc --ls | jq '.[] select(.bytes > 50000000)'"}, {"line": 179, "command": "ls -l /usr/bin | jc --ls | jq '.[]. select(.bytes > 50000000)'"}, {"line": 180, "command": "ls -l /usr/bin | jc --ls | jq '.[] select(.bytes > 50000000)'"}, {"line": 181, "command": "ls -l /usr/bin | jc --ls | jq '.[] . select(.bytes > 50000000)'"}, {"line": 182, "command": "ls -l /usr/bin | jc --ls | jq '[]. select(.bytes > 50000000)'"}, {"line": 183, "command": "ls -l /usr/bin | jc --ls | jq '[].select(.bytes > 50000000)'"}, {"line": 184, "command": "ls -l /usr/bin | jc --ls | jq '.[].select(.bytes > 50000000)'"}, {"line": 185, "command": "ls -l /usr/bin | jc --ls | jq .[] | jq 'select(.bytes > 50000000)'"}, {"line": 186, "command": "ls"}, {"line": 187, "command": "mkdir git"}, {"line": 188, "command": "cd git/"}, {"line": 189, "command": "ls"}, {"line": 190, "command": "git clone https://github.com/kellyjonbrazil/jc.git"}, {"line": 191, "command": "cd jc/"}, {"line": 192, "command": "ls"}, {"line": 193, "command": "cat README.md "}, {"line": 194, "command": "cd .."}, {"line": 195, "command": "ls"}, {"line": 196, "command": "rm -rf jc/"}, {"line": 197, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 198, "command": "ls"}, {"line": 199, "command": "cd jc/"}, {"line": 200, "command": "ls"}, {"line": 201, "command": "cat README.md "}, {"line": 202, "command": "pip3 list"}, {"line": 203, "command": "pip3 unistall jc"}, {"line": 204, "command": "pip3 uninstall jc"}, {"line": 205, "command": "jc"}, {"line": 206, "command": "ls"}, {"line": 207, "command": "pip3 install --upgrade -e ."}, {"line": 208, "command": "jc"}, {"line": 209, "command": "ls"}, {"line": 210, "command": "cd jc"}, {"line": 211, "command": "ls"}, {"line": 212, "command": "cd parsers/"}, {"line": 213, "command": "ls"}, {"line": 214, "command": "netstat -lp | jc --netstat"}, {"line": 215, "command": "ls"}, {"line": 216, "command": "netstat -p | jc --netstat"}, {"line": 217, "command": "netstat -lp | jc --netstat"}, {"line": 218, "command": "rm netstat.py "}, {"line": 219, "command": "vi netstat.py"}, {"line": 220, "command": "netstat -lp | jc --netstat"}, {"line": 221, "command": "netstat -l | jc --netstat"}, {"line": 222, "command": "netstat -l | jc --netstat -p"}, {"line": 223, "command": "netstat -lp | jc --netstat -p"}, {"line": 224, "command": "netstat -lp"}, {"line": 225, "command": "sudo netstat -lp | jc --netstat -p"}, {"line": 226, "command": "rm netstat.py "}, {"line": 227, "command": "vi netstat.py"}, {"line": 228, "command": "sudo netstat -lp | jc --netstat -p"}, {"line": 229, "command": "netstat -lp | jc --netstat -p"}, {"line": 230, "command": "rm netstat.py "}, {"line": 231, "command": "vi netstat.py"}, {"line": 232, "command": "netstat -lp | jc --netstat -p"}, {"line": 233, "command": "sudo netstat -lp | jc --netstat -p"}, {"line": 234, "command": "sudo netstat -p | jc --netstat -p"}, {"line": 235, "command": "netstat -p | jc --netstat -p"}, {"line": 236, "command": "cd .."}, {"line": 237, "command": "cd ~"}, {"line": 238, "command": "ls"}, {"line": 239, "command": "cat trafficgen.sh "}, {"line": 240, "command": "mkdir tmp"}, {"line": 241, "command": "cd tmp"}, {"line": 242, "command": "history | grep clone"}, {"line": 243, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat | jc --netstat"}, {"line": 244, "command": "ls"}, {"line": 245, "command": "rm -rf jc/"}, {"line": 246, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat"}, {"line": 247, "command": "rm -rf jc/"}, {"line": 248, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat | jc --netstat"}, {"line": 249, "command": "rm -rf jc/"}, {"line": 250, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat"}, {"line": 251, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": 252, "command": "rm -rf jc/"}, {"line": 253, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": 254, "command": "rm -rf jc/"}, {"line": 255, "command": "git clone https://github.com/kellyjonbrazil/jc.git & sleep 1; netstat -p | jc --netstat -p"}, {"line": 256, "command": "netstat -l | jc --netstat -p"}, {"line": 257, "command": "netstat -ln | jc --netstat -p"}, {"line": 258, "command": "netstat -lnp | jc --netstat -p"}, {"line": 259, "command": "sudo netstat -lnp | jc --netstat -p"}, {"line": 260, "command": "history | grep clone"}, {"line": 261, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 262, "command": "ls"}, {"line": 263, "command": "ps -a"}, {"line": 264, "command": "ps -ef"}, {"line": 265, "command": "ps -axz"}, {"line": 266, "command": "ps -ax"}, {"line": 267, "command": "ps -axu"}, {"line": 268, "command": "cd ~/git/"}, {"line": 269, "command": "pip3 uninstall jc"}, {"line": 270, "command": "history | grep clone"}, {"line": 271, "command": "ls"}, {"line": 272, "command": "rm -rf jc/"}, {"line": 273, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 274, "command": "pip3 install --user -e ."}, {"line": 275, "command": "cd jc/"}, {"line": 276, "command": "pip3 install --user -e ."}, {"line": 277, "command": "jc"}, {"line": 278, "command": "ps | jc --ps"}, {"line": 279, "command": "ps | jc --ps -p"}, {"line": 280, "command": "ps -ef | jc --ps -p"}, {"line": 281, "command": "ps -ax | jc --ps -p"}, {"line": 282, "command": "ps -axu | jc --ps -p"}, {"line": 283, "command": "ps -axu | jc --ps | jq ."}, {"line": 284, "command": "ps -ef | jc --ps -p"}, {"line": 285, "command": "route"}, {"line": 286, "command": "route -n"}, {"line": 287, "command": "ls"}, {"line": 288, "command": "cd .."}, {"line": 289, "command": "pip3 uninstall jc"}, {"line": 290, "command": "ls"}, {"line": 291, "command": "rm -rf jc/"}, {"line": 292, "command": "history | grep clone"}, {"line": 293, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 294, "command": "ls"}, {"line": 295, "command": "cd jc/"}, {"line": 296, "command": "pip3 install --user -e ."}, {"line": 297, "command": "route | jc --route -p"}, {"line": 298, "command": "route -v | jc --route -p"}, {"line": 299, "command": "route | jc --route -p"}, {"line": 300, "command": "route -n | jc --route -p"}, {"line": 301, "command": "route -n | jc --route"}, {"line": 302, "command": "ls -l | jc --ls"}, {"line": 303, "command": "netstat -l | jc --ls"}, {"line": 304, "command": "netstat -l | jc --netstat"}, {"line": 305, "command": "netstat -l | jc"}, {"line": 306, "command": "ifconfig | jc --ifconfig"}, {"line": 307, "command": "route | jc --route"}, {"line": 308, "command": "ps -ef | jc --ps -p"}, {"line": 309, "command": "pip list"}, {"line": 310, "command": "pip3 list"}, {"line": 311, "command": "ls"}, {"line": 312, "command": "netstat | jc --netstat -p"}, {"line": 313, "command": "netstat -l | jc --netstat -p"}, {"line": 314, "command": "pip3 list"}, {"line": 315, "command": "cd jc/parsers/"}, {"line": 316, "command": "ls"}, {"line": 317, "command": "ls -l | jc --ls"}, {"line": 318, "command": "ls -l | jc --ls -p"}, {"line": 319, "command": "ls -l /var | jc --ls -p"}, {"line": 320, "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": 321, "command": "ls -l /usr/local/bin/"}, {"line": 322, "command": "ls -l /usr/local"}, {"line": 323, "command": "ls -l ~/.local/"}, {"line": 324, "command": "ls -l ~/.local/bin/"}, {"line": 325, "command": "ls -l ~/.local/lib"}, {"line": 326, "command": "ls -l ~/.local/lib/python3.6/"}, {"line": 327, "command": "ls -l ~/.local/lib/python3.6/site-packages/"}, {"line": 328, "command": "ls -l ~/.local/lib/python3.6/site-packages/ifconfigparser/"}, {"line": 329, "command": "ls -l ~/.local/lib/python3.6/site-packages/ifconfigparser/__pycache__/"}, {"line": 330, "command": "ls -l /"}, {"line": 331, "command": "ls -l / | jc --ls"}, {"line": 332, "command": "ls -l / | jc --ls -p"}, {"line": 333, "command": "rm ls.py "}, {"line": 334, "command": "vi ls.py"}, {"line": 335, "command": "ls -l / | jc --ls -p"}, {"line": 336, "command": "ls -l /"}, {"line": 337, "command": "rm ls.py "}, {"line": 338, "command": "vi ls.py"}, {"line": 339, "command": "ls -l / | jc --ls -p"}, {"line": 340, "command": "rm ls.py "}, {"line": 341, "command": "vi ls.py"}, {"line": 342, "command": "ls -l / | jc --ls -p"}, {"line": 343, "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": 344, "command": "rm ls.py "}, {"line": 345, "command": "vi ls.py"}, {"line": 346, "command": "ls -l /usr/local/bin | jc --ls -p"}, {"line": 347, "command": "ls -l / | jc --ls -p"}, {"line": 348, "command": "cd ~"}, {"line": 349, "command": "pip3 uninstall jc"}, {"line": 350, "command": "cd git/"}, {"line": 351, "command": "ls"}, {"line": 352, "command": "rm -rf jc/"}, {"line": 353, "command": "history | grep clone"}, {"line": 354, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 355, "command": "ls"}, {"line": 356, "command": "cd jc/"}, {"line": 357, "command": "pip3 install --user --upgrade -e ."}, {"line": 358, "command": "jc"}, {"line": 359, "command": "ls /usr/local/bin | jc --ls"}, {"line": 360, "command": "ls /usr/local/bin "}, {"line": 361, "command": "ls /usr/local/bin -l"}, {"line": 362, "command": "cd jc/parsers/"}, {"line": 363, "command": "ls"}, {"line": 364, "command": "rm ls.py "}, {"line": 365, "command": "vi ls.py"}, {"line": 366, "command": "ls /usr/local/bin "}, {"line": 367, "command": "ls /usr/local/bin | jc --ls"}, {"line": 368, "command": "ls -l /usr/local/bin | jc --ls"}, {"line": 369, "command": "ls -al /usr/local/bin | jc --ls"}, {"line": 370, "command": "ls -al /usr/local/bin | jc --ls -p"}, {"line": 371, "command": "cd .."}, {"line": 372, "command": "pip3 uninstall jc"}, {"line": 373, "command": "rm -rf jc/"}, {"line": 374, "command": "history | grep clone"}, {"line": 375, "command": "git clone --single-branch --branch dev https://github.com/kellyjonbrazil/jc.git"}, {"line": 376, "command": "cd jc/"}, {"line": 377, "command": "pip3 install --user --upgrade -e ."}, {"line": 378, "command": "jc"}, {"line": 379, "command": "ls /usr/local/bin | jc --ls"}, {"line": 380, "command": "ls -l /usr/local/bin | jc --ls"}, {"line": 381, "command": "ls -al /usr/local/bin | jc --ls"}, {"line": 382, "command": "ls -al /usr/local/bin | jc --ls -p"}, {"line": 383, "command": "ps -ef | jc --ps"}, {"line": 384, "command": "ps -ef | jc --ps -p"}, {"line": 385, "command": "pip3 list"}, {"line": 386, "command": "ls"}, {"line": 387, "command": "./build-package.sh "}, {"line": 388, "command": "ls"}, {"line": 389, "command": "./pypi-upload.sh "}, {"line": 390, "command": "cd .."}, {"line": 391, "command": "ls"}, {"line": 392, "command": "pip3 uninstall jc"}, {"line": 393, "command": "rm -rf jc/"}, {"line": 394, "command": "pip3 install --user --upgrade jc"}, {"line": 395, "command": "pip3 list"}, {"line": 396, "command": "w"}, {"line": 397, "command": "w -f"}, {"line": 398, "command": "w | jc --route"}, {"line": 399, "command": "w | jc --route -p"}, {"line": 400, "command": "w -f | jc --route -p"}, {"line": 401, "command": "route"}, {"line": 402, "command": "uptime"}, {"line": 403, "command": "ls -l /bin | jc --ls -p"}, {"line": 404, "command": "lsof | jc --lsof -p"}, {"line": 405, "command": "sudo lsof | jc --lsof -p"}, {"line": 406, "command": "w | jc --w -p"}, {"line": 407, "command": "uptime | jc --uptime -p"}, {"line": 408, "command": "ls"}, {"line": 409, "command": "cd testfiles/"}, {"line": 410, "command": "ls"}, {"line": 411, "command": "rm tests.sh "}, {"line": 412, "command": "vi tests.sh"}, {"line": 413, "command": "chmod +x tests.sh "}, {"line": 414, "command": "./tests.sh "}, {"line": 415, "command": "ls"}, {"line": 416, "command": "cat iptables-filter.out "}, {"line": 417, "command": "cat iptables-filter-nv.out "}, {"line": 418, "command": "ls"}, {"line": 419, "command": "ls -al"}, {"line": 420, "command": "man history"}, {"line": 421, "command": "rm tests.sh "}, {"line": 422, "command": "vi tests.sh"}, {"line": 423, "command": "chmod +x tests.sh "}, {"line": 424, "command": "./tests.sh "}, {"line": 425, "command": "ls -al"}, {"line": 426, "command": "cat netstat.out "}, {"line": 427, "command": "ls"}, {"line": 428, "command": "cat w"}, {"line": 429, "command": "cat w.out "}, {"line": 430, "command": "cat uname-a.out "}, {"line": 431, "command": "rm tests.sh "}, {"line": 432, "command": "vi tests.sh"}, {"line": 433, "command": "chmod +x tests.sh "}, {"line": 434, "command": "./tests.sh "}, {"line": 435, "command": "ls -al"}, {"line": 436, "command": "cat iptables-filter.out "}, {"line": 437, "command": "uname"}, {"line": 438, "command": "uname -a"}, {"line": 439, "command": "cd /etc/"}, {"line": 440, "command": "ls"}, {"line": 441, "command": "uname -a"}, {"line": 442, "command": "ls"}, {"line": 443, "command": "cat debian_version "}, {"line": 444, "command": "lsb_release -a "}, {"line": 445, "command": "uname -a"}, {"line": 446, "command": "lsb_release "}, {"line": 447, "command": "lsb_release -a"}, {"line": 448, "command": "ifconfig"}, {"line": 449, "command": "cd ~"}, {"line": 450, "command": "cd testfiles/"}, {"line": 451, "command": "ls"}, {"line": 452, "command": "cat history.out "}, {"line": 453, "command": "history > history.out"}] diff --git a/tests/test_crontab.py b/tests/test_crontab.py index 3abc8952..9f9558bc 100644 --- a/tests/test_crontab.py +++ b/tests/test_crontab.py @@ -13,28 +13,16 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/crontab.out'), 'r') as f: self.centos_7_7_crontab = f.read() - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/crontab.out'), 'r') as f: - self.ubuntu_18_4_crontab = f.read() - # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/crontab.json'), 'r') as f: self.centos_7_7_crontab_json = json.loads(f.read()) - with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/crontab.json'), 'r') as f: - self.ubuntu_18_4_crontab_json = json.loads(f.read()) - def test_crontab_centos_7_7(self): """ Test 'crontab' on Centos 7.7 """ self.assertEqual(jc.parsers.crontab.parse(self.centos_7_7_crontab, quiet=True), self.centos_7_7_crontab_json) - def test_crontab_ubuntu_18_4(self): - """ - Test 'crontab' on Ubuntu 18.4 - """ - self.assertEqual(jc.parsers.crontab.parse(self.ubuntu_18_4_crontab, quiet=True), self.ubuntu_18_4_crontab_json) - if __name__ == '__main__': unittest.main() diff --git a/tests/test_crontab_u.py b/tests/test_crontab_u.py new file mode 100644 index 00000000..0f455a0f --- /dev/null +++ b/tests/test_crontab_u.py @@ -0,0 +1,40 @@ +import os +import json +import unittest +import jc.parsers.crontab_u + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/crontab-u.out'), 'r') as f: + self.ubuntu_18_4_crontab_u = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/crontab-u.out'), 'r') as f: + self.centos_7_7_crontab_u = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-18.04/crontab-u.json'), 'r') as f: + self.ubuntu_18_4_crontab_u_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/crontab-u.json'), 'r') as f: + self.centos_7_7_crontab_u_json = json.loads(f.read()) + + def test_crontab_u_ubuntu_18_4(self): + """ + Test 'crontab' on Ubuntu 18.4 (has a user field) + """ + self.assertEqual(jc.parsers.crontab_u.parse(self.ubuntu_18_4_crontab_u, quiet=True), self.ubuntu_18_4_crontab_u_json) + + def test_crontab_u_centos_7_7(self): + """ + Test 'crontab' on Centos 7.7 (has a user field) + """ + self.assertEqual(jc.parsers.crontab_u.parse(self.centos_7_7_crontab_u, quiet=True), self.centos_7_7_crontab_u_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_id.py b/tests/test_id.py new file mode 100644 index 00000000..cc0d0b34 --- /dev/null +++ b/tests/test_id.py @@ -0,0 +1,40 @@ +import os +import json +import unittest +import jc.parsers.id + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/id.out'), 'r') as f: + self.centos_7_7_id = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/id.out'), 'r') as f: + self.osx_10_14_6_id = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/id.json'), 'r') as f: + self.centos_7_7_id_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/id.json'), 'r') as f: + self.osx_10_14_6_id_json = json.loads(f.read()) + + def test_id_centos_7_7(self): + """ + Test 'id' on Centos 7.7 + """ + self.assertEqual(jc.parsers.id.parse(self.centos_7_7_id, quiet=True), self.centos_7_7_id_json) + + def test_id_osx_10_14_6(self): + """ + Test 'id' on OSX 10.14.6 + """ + self.assertEqual(jc.parsers.id.parse(self.osx_10_14_6_id, quiet=True), self.osx_10_14_6_id_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_ini.py b/tests/test_ini.py new file mode 100644 index 00000000..a857cd8c --- /dev/null +++ b/tests/test_ini.py @@ -0,0 +1,40 @@ +import os +import unittest +import json +import jc.parsers.ini + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-test.ini'), 'r') as f: + self.generic_ini_test = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.ini'), 'r') as f: + self.generic_ini_iptelserver = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-test.json'), 'r') as f: + self.generic_ini_test_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/ini-iptelserver.json'), 'r') as f: + self.generic_ini_iptelserver_json = json.loads(f.read()) + + def test_ini_test(self): + """ + Test the test ini file + """ + self.assertEqual(jc.parsers.ini.parse(self.generic_ini_test, quiet=True), self.generic_ini_test_json) + + def test_ini_iptelserver(self): + """ + Test the iptelserver ini file + """ + self.assertEqual(jc.parsers.ini.parse(self.generic_ini_iptelserver, quiet=True), self.generic_ini_iptelserver_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_xml.py b/tests/test_xml.py new file mode 100644 index 00000000..4b5c3ce3 --- /dev/null +++ b/tests/test_xml.py @@ -0,0 +1,40 @@ +import os +import unittest +import json +import jc.parsers.xml + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/xml-cd_catalog.xml'), 'r') as f: + self.generic_xml_cd_catalog = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/xml-foodmenu.xml'), 'r') as f: + self.generic_xml_foodmenu = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/xml-cd_catalog.json'), 'r') as f: + self.generic_xml_cd_catalog_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/xml-foodmenu.json'), 'r') as f: + self.generic_xml_foodmenu_json = json.loads(f.read()) + + def test_xml_cd_catalog(self): + """ + Test the cd catalog xml file + """ + self.assertEqual(jc.parsers.xml.parse(self.generic_xml_cd_catalog, quiet=True), self.generic_xml_cd_catalog_json) + + def test_xml_foodmenu(self): + """ + Test the food menu xml file + """ + self.assertEqual(jc.parsers.xml.parse(self.generic_xml_foodmenu, quiet=True), self.generic_xml_foodmenu_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_yaml.py b/tests/test_yaml.py new file mode 100644 index 00000000..381dd9e2 --- /dev/null +++ b/tests/test_yaml.py @@ -0,0 +1,40 @@ +import os +import unittest +import json +import jc.parsers.yaml + +THIS_DIR = os.path.dirname(os.path.abspath(__file__)) + + +class MyTests(unittest.TestCase): + + def setUp(self): + # input + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/yaml-istio-sc.yaml'), 'r') as f: + self.generic_yaml_istio_sc = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/yaml-istio-sidecar.yaml'), 'r') as f: + self.generic_yaml_istio_sidecar = f.read() + + # output + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/yaml-istio-sc.json'), 'r') as f: + self.generic_yaml_istio_sc_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/generic/yaml-istio-sidecar.json'), 'r') as f: + self.generic_yaml_istio_sidecar_json = json.loads(f.read()) + + def test_yaml_istio_sc(self): + """ + Test the Istio SC yaml file + """ + self.assertEqual(jc.parsers.yaml.parse(self.generic_yaml_istio_sc, quiet=True), self.generic_yaml_istio_sc_json) + + def test_yaml_istio_sidecar(self): + """ + Test the Istio Sidecar yaml file + """ + self.assertEqual(jc.parsers.yaml.parse(self.generic_yaml_istio_sidecar, quiet=True), self.generic_yaml_istio_sidecar_json) + + +if __name__ == '__main__': + unittest.main()