├── .appveyor.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── fixtures
├── archs.go
├── boot_hooks.go
├── bootlog.go
├── cfiles.go
├── composer.go
├── docker_packages.go
├── docker_tags.go
├── extensions.go
├── git.go
├── gomod.go
├── os_releases.go
└── packages.go
├── go.mod
├── go.sum
├── main.go
└── modules
├── bootlog.go
├── botnet.go
├── cargo.go
├── cc.go
├── color.go
├── composer.go
├── cryptomining.go
├── docker.go
├── download.go
├── generators.go
├── git.go
├── gomod.go
├── kernel_compile.go
├── memdump.go
├── moduler.go
├── moduler_test.go
└── weblog.go
/.appveyor.yml:
--------------------------------------------------------------------------------
1 | build: off
2 |
3 | clone_folder: c:\gopath\src\github.com\chenjiandongx\oscar
4 |
5 | environment:
6 | GOPATH: c:\gopath
7 |
8 | stack: go 1.13
9 |
10 | before_test:
11 | - go get -t -v ./...
12 | - go vet ./...
13 |
14 | test_script:
15 | - go test -v ./...
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and plugins
2 | *.exe
3 | *.exe~
4 | *.dll
5 | *.so
6 | *.dylib
7 |
8 | # Test binary, built with `go test -c`
9 | *.test
10 |
11 | # Output of the go coverage tool, specifically when used with LiteIDE
12 | *.out
13 |
14 | # IDE
15 | .idea/
16 | .vscode/
17 | .DS_Store
18 |
19 | # binary
20 | oscar*
21 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 | language: go
3 | go:
4 | - 1.13.x
5 | install:
6 | - # Do nothing. This is needed to prevent default install action
7 | - # "go get -t -v ./..." from happening here (we want it to happen inside script step).
8 | script:
9 | - go get -t -v ./...
10 | - diff -u <(echo -n) <(go fmt ./...)
11 | - go vet .
12 | - sudo `which go` test -v -race ./...
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020~now chenjiandongx
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Oscar
2 |
3 | > 🐶 Next generation building tool for nothing
4 |
5 | [](https://travis-ci.org/chenjiandongx/oscar) [](https://ci.appveyor.com/project/chenjiandongx/oscar/branch/master) [](https://opensource.org/licenses/MIT) [](https://github.com/chenjiandongx/oscar)
6 |
7 |
8 |
9 | ## Motivation
10 |
11 | Imitation is the sincerest form of flattery.
12 |
13 | [Oscar](https://github.com/chenjiandongx/oscar) is yet another nonsense activity generator for Golang, which is inspired by the rust project [svenstaro/genact](https://github.com/svenstaro/genact). The aim of oscar is to ~~**pretend**~~ prove that you are busy working so that you could take a rest or drink a cup of cappuccino.
14 |
15 |
16 | ## Features
17 |
18 | * blazing fast(nothing happend actually)
19 | * variety modules
20 | * easy to use and extend
21 |
22 |
23 | ## Installation
24 |
25 | ### Go
26 |
27 | The classic way to install
28 |
29 | ```bash
30 | $ go get -u github.com/chenjiandongx/oscar
31 | ```
32 |
33 | ### MacOS, Linux, Windows
34 |
35 | The binary is published on the [release page](https://github.com/chenjiandongx/oscar/releases).
36 |
37 |
38 | ## Usage
39 |
40 | ```bash
41 | $ oscar --help
42 | Next generation building tool for nothing
43 |
44 | Usage:
45 | oscar [command]
46 |
47 | Available Commands:
48 | help Help about any command
49 | list List all available modules
50 | run Run with the specific module
51 |
52 | Flags:
53 | -h, --help help for oscar
54 | -v, --version version for oscar
55 |
56 | Use "oscar [command] --help" for more information about a command.
57 | ```
58 |
59 | ### Modules list
60 |
61 | ```bash
62 | $ oscar list
63 | - bootlog
64 | - botnet
65 | - cargo
66 | - cc
67 | - composer
68 | - cryptomining
69 | - docker
70 | - download
71 | - git
72 | - gomod
73 | - kernel_compile
74 | - memdump
75 | - weblog
76 | ```
77 |
78 | ### At a glance
79 |
80 |
81 |
82 |
83 |
84 | 
85 | 
86 |
87 |
88 | ### Give it a try
89 |
90 | - [bootlog](https://oscar.chenjiandongx.me?module=bootlog)
91 | - [botnet](https://oscar.chenjiandongx.me?module=botnet)
92 | - [cargo](https://oscar.chenjiandongx.me?module=cargo)
93 | - [cc](https://oscar.chenjiandongx.me?module=cc)
94 | - [composer](https://oscar.chenjiandongx.me?module=composer)
95 | - [cryptomining](https://oscar.chenjiandongx.me?module=cryptomining)
96 | - [docker](https://oscar.chenjiandongx.me?module=docker)
97 | - [download](https://oscar.chenjiandongx.me?module=download)
98 | - [git](https://oscar.chenjiandongx.me?module=git)
99 | - [gomod](https://oscar.chenjiandongx.me?module=gomod)
100 | - [kernel_compile](https://oscar.chenjiandongx.me?module=kernel_compile)
101 | - [memdump](https://oscar.chenjiandongx.me?module=memdump)
102 | - [weblog](https://oscar.chenjiandongx.me?module=weblog)
103 |
104 |
105 | ### Changelog
106 |
107 | #### V0.2.0 - 2020-08-15
108 |
109 | * Add the `-c` flag to make the cpu on the fly and let the fan noisy [#2](https://github.com/chenjiandongx/oscar/issues/2).
110 |
111 | #### V0.1.0 - 2020-08-12
112 |
113 | * Beta: the first release version of oscar.
114 |
115 |
116 | ## License
117 |
118 | MIT [©chenjiandongx](https://github.com/chenjiandongx)
119 |
--------------------------------------------------------------------------------
/fixtures/archs.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var archs = `
4 | alpha
5 | arc
6 | arm
7 | arm64
8 | blackfin
9 | c6x
10 | cris
11 | frv
12 | h8300
13 | hexagon
14 | ia64
15 | m32r
16 | m68k
17 | metag
18 | microblaze
19 | mips
20 | mn10300
21 | nios2
22 | openrisc
23 | parisc
24 | powerpc
25 | s390
26 | score
27 | sh
28 | sparc
29 | tile
30 | um
31 | unicore32
32 | x86
33 | xtensa
34 | `
35 |
36 | var Archs = readLines(archs)
37 |
--------------------------------------------------------------------------------
/fixtures/boot_hooks.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | import (
4 | "bufio"
5 | "bytes"
6 | )
7 |
8 | var bootHooks = `
9 | base
10 | udev
11 | usr
12 | resume
13 | autodetect
14 | modconf
15 | block
16 | net
17 | mdadm
18 | mdadm_udev
19 | keyboard
20 | keymap
21 | consolefont
22 | encrypt
23 | lvm2
24 | fsck
25 | filesystems
26 | `
27 |
28 | func readLines(in string) []string {
29 | var buf bytes.Buffer
30 | buf.WriteString(in)
31 |
32 | lines := make([]string, 0)
33 | scanner := bufio.NewScanner(&buf)
34 | for scanner.Scan() {
35 | lines = append(lines, scanner.Text())
36 | }
37 |
38 | // the first line is empty
39 | return lines[1:]
40 | }
41 |
42 | var BootHooks = readLines(bootHooks)
43 |
--------------------------------------------------------------------------------
/fixtures/bootlog.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var bootLog = `
4 | PMAP: PCID enabled
5 | Hacknet Kernel Version 1.0.0: Tue Oct 11 20:56:35 PDT 2011; root:xnu-1699.22.73~1/RELEASE_X86_64
6 | vm_page_bootstrap: 987323 free pages and 53061 wired pages
7 | kext submap [0xffffff7f8072e000 - 0xffffff8000000000], kernel text [0xffffff8000200000 - 0xffffff800072e000]
8 | zone leak detection enabled
9 | standard timeslicing quantum is 10000 us
10 | mig_table_max_displ = 72
11 | TSC Deadline Timer supported and enabled
12 | HackNetACPICPU: ProcessorId=1 LocalApicId=0 Enabled
13 | HackNetACPICPU: ProcessorId=2 LocalApicId=2 Enabled
14 | HackNetACPICPU: ProcessorId=3 LocalApicId=1 Enabled
15 | HackNetACPICPU: ProcessorId=4 LocalApicId=3 Enabled
16 | HackNetACPICPU: ProcessorId=5 LocalApicId=255 Disabled
17 | HackNetACPICPU: ProcessorId=6 LocalApicId=255 Disabled
18 | HackNetACPICPU: ProcessorId=7 LocalApicId=255 Disabled
19 | HackNetACPICPU: ProcessorId=8 LocalApicId=255 Disabled
20 | calling mpo_policy_init for TMSafetyNet
21 | Security policy loaded: Safety net for Time Machine (TMSafetyNet)
22 | calling mpo_policy_init for Sandbox
23 | Security policy loaded: Seatbelt sandbox policy (Sandbox)
24 | calling mpo_policy_init for Quarantine
25 | Security policy loaded: Quarantine policy (Quarantine)
26 | MAC Framework successfully initialized
27 | using 16384 buffer headers and 10240 cluster IO buffer headers
28 | IOAPIC: Version 0x20 Vectors 64:87
29 | ACPI: System State [S0 S3 S4 S5] (S3)
30 | PFM64 0xf10000000, 0xf0000000
31 | [ PCI configuration begin ]
32 | HackNetIntelCPUPowerManagement: Turbo Ratios 0046
33 | HackNetIntelCPUPowerManagement: (built 13:08:12 Jun 18 2011) initialization complete
34 | console relocated to 0xf10000000
35 | PCI configuration changed (bridge=16 device=4 cardbus=0)
36 | [ PCI configuration end, bridges 12 devices 16 ]
37 | mbinit: done [64 MB total pool size, (42/21) split]
38 | Pthread support ABORTS when sync kernel primitives misused
39 | com.HackNet.HackNetFSCompressionTypeZlib kmod start
40 | com.HackNet.HackNetTrololoBootScreen kmod start
41 | com.HackNet.HackNetFSCompressionTypeZlib load succeeded
42 | com.HackNet.HackNetFSCompressionTypeDataless load succeeded
43 | HackNetIntelCPUPowerManagementClient: ready
44 | BTCOEXIST off
45 | wl0: Broadcom BCM4331 802.11 Wireless Controller
46 | 5.100.98.75
47 | FireWire (OHCI) Lucent ID 5901 built-in now active, GUID c82a14fffee4a086; max speed s800.
48 | rooting via boot-uuid from /chosen: F5670083-AC74-33D3-8361-AC1977EE4AA2
49 | Waiting on IOProviderClass
50 | IOResourcesIOResourceMatchboot-uuid-media
51 | Got boot device = IOService:/HackNetACPIPlatformExpert/PCI0@0/HackNetACPIPCI/SATA@1F,2/
52 | HackNetIntelPchSeriesAHCI/PRT0@0/IOAHCIDevice@0/HackNetAHCIDiskDriver/SarahI@sTheBestDriverIOAHCIBlockStorageDevice/IOBlockStorageDriver/
53 | HackNet SSD TS128C Media/IOGUIDPartitionScheme/Customer@2
54 | BSD root: disk0s2, major 14, minor 2
55 | Kernel is LP64
56 | IOThunderboltSwitch::i2cWriteDWord - status = 0xe00002ed
57 | IOThunderboltSwitch::i2cWriteDWord - status = 0x00000000
58 | IOThunderboltSwitch::i2cWriteDWord - status = 0xe00002ed
59 | IOThunderboltSwitch::i2cWriteDWord - status = 0xe00002ed
60 | HackNetUSBMultitouchDriver::checkStatus - received Status Packet, Payload 2: device was reinitialized
61 | MottIsAScrub::checkstatus - true, Mott::Scrub
62 | [IOBluetoothHCIController::setConfigState] calling registerService
63 | AirPort_Brcm4331: Ethernet address e4:ce:8f:46:18:d2
64 | IO80211Controller::dataLinkLayerAttachComplete(): adding HackNetEFINVRAM notification
65 | IO80211Interface::efiNVRAMPublished():
66 | Created virtif 0xffffff800c32ee00 p2p0
67 | BCM5701Enet: Ethernet address c8:2a:14:57:a4:7a
68 | Previous Shutdown Cause: 3
69 | NTFS driver 3.8 [Flags: R/W].
70 | NTFS volume name BOOTCAMP, version 3.1.
71 | DSMOS has arrived
72 | en1: 802.11d country code set to 'US'.
73 | en1: Supported channels 1 2 3 4 5 6 7 8 9 10 11 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140 149 153 157 161 165
74 | MacAuthEvent en1 Auth result for: 00:60:64:1e:e9:e4 MAC AUTH succeeded
75 | MacAuthEvent en1 Auth result for: 00:60:64:1e:e9:e4 Unsolicited Auth
76 | wlEvent: en1 en1 Link UP
77 | AirPort: Link Up on en1
78 | en1: BSSID changed to 00:60:64:1e:e9:e4
79 | virtual bool IOHIDEventSystemUserClient::initWithTask(task*, void*, UInt32):
80 | Client task not privileged to open IOHIDSystem for mapping memory (e00002c1)
81 | ACPI: Preparing to enter system sleep state S3
82 | ACPI: EC: event blocked
83 | ACPI: EC: EC stopped
84 | PM: Saving platform NVS memory
85 | Disabling non-boot CPUs ...
86 | smpboot: CPU 1 is now offline
87 | smpboot: CPU 2 is now offline
88 | smpboot: CPU 3 is now offline
89 | ACPI: Low-level resume complete
90 | ACPI: EC: EC started
91 | PM: Restoring platform NVS memory
92 | Enabling non-boot CPUs ...
93 | x86: Booting SMP configuration:
94 | smpboot: Booting Node 0 Processor 1 APIC 0x1
95 | cache: parent cpu1 should not be sleeping
96 | CPU1 is up
97 | smpboot: Booting Node 0 Processor 2 APIC 0x2
98 | cache: parent cpu2 should not be sleeping
99 | CPU2 is up
100 | smpboot: Booting Node 0 Processor 3 APIC 0x3
101 | cache: parent cpu3 should not be sleeping
102 | CPU3 is up
103 | ACPI: Waking up from system sleep state S3
104 | ACPI: EC: event unblocked
105 | x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
106 | x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
107 | x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
108 | x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
109 | x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
110 | e820: BIOS-provided physical RAM map:
111 | BIOS-e820: [mem 0x0000000000000000-0x0000000000057fff] usable
112 | BIOS-e820: [mem 0x0000000000058000-0x0000000000058fff] reserved
113 | BIOS-e820: [mem 0x0000000000059000-0x000000000008bfff] usable
114 | BIOS-e820: [mem 0x000000000008c000-0x000000000009ffff] reserved
115 | BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
116 | BIOS-e820: [mem 0x0000000000100000-0x00000000aa248fff] usable
117 | BIOS-e820: [mem 0x00000000aa249000-0x00000000acbfefff] reserved
118 | BIOS-e820: [mem 0x00000000acbff000-0x00000000acd7efff] ACPI NVS
119 | BIOS-e820: [mem 0x00000000acd7f000-0x00000000acdfefff] ACPI data
120 | BIOS-e820: [mem 0x00000000acdff000-0x00000000acdfffff] usable
121 | BIOS-e820: [mem 0x00000000f80f8000-0x00000000f80f8fff] reserved
122 | BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
123 | BIOS-e820: [mem 0x0000000100000000-0x000000044dffffff] usable
124 | NX (Execute Disable) protection: active
125 | e820: update [mem 0xa2034018-0xa2044057] usable ==> usable
126 | e820: update [mem 0xa2034018-0xa2044057] usable ==> usable
127 | extended physical RAM map:
128 | reserve setup_data: [mem 0x0000000000000000-0x0000000000057fff] usable
129 | reserve setup_data: [mem 0x0000000000058000-0x0000000000058fff] reserved
130 | reserve setup_data: [mem 0x0000000000059000-0x000000000008bfff] usable
131 | reserve setup_data: [mem 0x000000000008c000-0x000000000009ffff] reserved
132 | reserve setup_data: [mem 0x00000000000e0000-0x00000000000fffff] reserved
133 | reserve setup_data: [mem 0x0000000000100000-0x00000000a2034017] usable
134 | reserve setup_data: [mem 0x00000000a2034018-0x00000000a2044057] usable
135 | reserve setup_data: [mem 0x00000000a2044058-0x00000000aa248fff] usable
136 | reserve setup_data: [mem 0x00000000aa249000-0x00000000acbfefff] reserved
137 | reserve setup_data: [mem 0x00000000acbff000-0x00000000acd7efff] ACPI NVS
138 | reserve setup_data: [mem 0x00000000acd7f000-0x00000000acdfefff] ACPI data
139 | reserve setup_data: [mem 0x00000000acdff000-0x00000000acdfffff] usable
140 | reserve setup_data: [mem 0x00000000f80f8000-0x00000000f80f8fff] reserved
141 | reserve setup_data: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
142 | reserve setup_data: [mem 0x0000000100000000-0x000000044dffffff] usable
143 | efi: ACPI=0xacdfe000 ACPI 2.0=0xacdfe014 SMBIOS=0xacbfe000 ESRT=0xaa67e000
144 | random: fast init done
145 | SMBIOS 2.7 present.
146 | tsc: Fast TSC calibration using PIT
147 | e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
148 | e820: remove [mem 0x000a0000-0x000fffff] usable
149 | e820: last_pfn = 0x44e000 max_arch_pfn = 0x400000000
150 | MTRR default type: write-back
151 | MTRR fixed ranges enabled:
152 | 00000-9FFFF write-back
153 | A0000-BFFFF uncachable
154 | C0000-FFFFF write-protect
155 | MTRR variable ranges enabled:
156 | 0 base 00C0000000 mask 7FE0000000 uncachable
157 | 1 base 00B0000000 mask 7FF0000000 uncachable
158 | 2 base 00AE000000 mask 7FFE000000 uncachable
159 | 3 base 00AD000000 mask 7FFF000000 uncachable
160 | 4 base 00ACE00000 mask 7FFFE00000 uncachable
161 | 5 base 00E0000000 mask 7FE0000000 uncachable
162 | 6 disabled
163 | 7 disabled
164 | 8 disabled
165 | 9 disabled
166 | x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
167 | e820: last_pfn = 0xace00 max_arch_pfn = 0x400000000
168 | esrt: Reserving ESRT space from 0x00000000aa67e000 to 0x00000000aa67e060.
169 | Scanning 1 areas for low memory corruption
170 | Base memory trampoline at [ffff979680063000] 63000 size 24576
171 | Using GB pages for direct mapping
172 | BRK [0x44a212000, 0x44a212fff] PGTABLE
173 | BRK [0x44a213000, 0x44a213fff] PGTABLE
174 | BRK [0x44a214000, 0x44a214fff] PGTABLE
175 | BRK [0x44a215000, 0x44a215fff] PGTABLE
176 | BRK [0x44a216000, 0x44a216fff] PGTABLE
177 | BRK [0x44a217000, 0x44a217fff] PGTABLE
178 | Secure boot disabled
179 | RAMDISK: [mem 0x7f896000-0x7fffefff]
180 | ACPI: Early table checksum verification disabled
181 | ACPI: RSDP 0x00000000ACDFE014 000024 (v02 SuperCRA)
182 | ACPI: XSDT 0x00000000ACDFE1C0 0000EC (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
183 | ACPI: FACP 0x00000000ACDF9000 00010C (v05 SuperCRA TP-N11 00001140 PTEC 00000002)
184 | ACPI: DSDT 0x00000000ACDE3000 011204 (v02 SuperCRA TP-N11 00001140 INTL 20120711)
185 | ACPI: FACS 0x00000000ACD68000 000040
186 | ACPI: ASF! 0x00000000ACDFD000 0000A5 (v32 SuperCRA TP-N11 00001140 PTEC 00000002)
187 | ACPI: HPET 0x00000000ACDFC000 000038 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
188 | ACPI: ECDT 0x00000000ACDFB000 000052 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
189 | ACPI: APIC 0x00000000ACDF8000 000098 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
190 | ACPI: MCFG 0x00000000ACDF7000 00003C (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
191 | ACPI: SSDT 0x00000000ACDF6000 000033 (v01 SuperCRA TP-SSDT1 00000100 INTL 20120711)
192 | ACPI: SSDT 0x00000000ACDF5000 000486 (v01 SuperCRA TP-SSDT2 00000200 INTL 20120711)
193 | ACPI: SSDT 0x00000000ACDE2000 0009CB (v01 SuperCRA SataAhci 00001000 INTL 20120711)
194 | ACPI: SSDT 0x00000000ACDE1000 000152 (v01 SuperCRA Rmv_Batt 00001000 INTL 20120711)
195 | ACPI: SSDT 0x00000000ACDE0000 0006C5 (v01 SuperCRA Cpu0Ist 00003000 INTL 20120711)
196 | ACPI: SSDT 0x00000000ACDDF000 000B74 (v02 SuperCRA CpuSsdt 00003000 INTL 20120711)
197 | ACPI: SSDT 0x00000000ACDDE000 000369 (v02 SuperCRA CtdpB 00001000 INTL 20120711)
198 | ACPI: SSDT 0x00000000ACDDC000 001475 (v01 SuperCRA SaSsdt 00003000 INTL 20120711)
199 | ACPI: SSDT 0x00000000ACDDB000 000394 (v02 SuperCRA CppcTabl 00001000 INTL 20120711)
200 | ACPI: PCCT 0x00000000ACDDA000 00006E (v05 SuperCRA TP-N11 00001140 PTEC 00000002)
201 | ACPI: SSDT 0x00000000ACDD9000 000AC4 (v02 SuperCRA Cpc_Tabl 00001000 INTL 20120711)
202 | ACPI: TCPA 0x00000000ACDD8000 000032 (v02 PTL SuperCRA 06040000 LNVO 00000001)
203 | ACPI: SSDT 0x00000000ACDD7000 0006B0 (v02 Intel_ TpmTable 00001000 INTL 20120711)
204 | ACPI: UEFI 0x00000000ACDD6000 000042 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
205 | ACPI: POAT 0x00000000ACCB0000 000055 (v03 SuperCRA TP-N11 00001140 PTEC 00000002)
206 | ACPI: BATB 0x00000000ACDD5000 000046 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
207 | ACPI: FPDT 0x00000000ACDD4000 000064 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
208 | ACPI: UEFI 0x00000000ACDD3000 0002F6 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
209 | ACPI: DMAR 0x00000000ACDD2000 0000B0 (v01 SuperCRA TP-N11 00001140 PTEC 00000002)
210 | ACPI: Local APIC address 0xfee00000
211 | No NUMA configuration found
212 | Faking a node at [mem 0x0000000000000000-0x000000044dffffff]
213 | NODE_DATA(0) allocated [mem 0x44dffc000-0x44dffffff]
214 | Zone ranges:
215 | DMA [mem 0x0000000000001000-0x0000000000ffffff]
216 | DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
217 | Normal [mem 0x0000000100000000-0x000000044dffffff]
218 | Device empty
219 | Movable zone start for each node
220 | Early memory node ranges
221 | node 0: [mem 0x0000000000001000-0x0000000000057fff]
222 | node 0: [mem 0x0000000000059000-0x000000000008bfff]
223 | node 0: [mem 0x0000000000100000-0x00000000aa248fff]
224 | node 0: [mem 0x00000000acdff000-0x00000000acdfffff]
225 | node 0: [mem 0x0000000100000000-0x000000044dffffff]
226 | Initmem setup node 0 [mem 0x0000000000001000-0x000000044dffffff]
227 | On node 0 totalpages: 4162004
228 | DMA zone: 64 pages used for memmap
229 | DMA zone: 72 pages reserved
230 | DMA zone: 3978 pages, LIFO batch:0
231 | DMA32 zone: 10826 pages used for memmap
232 | DMA32 zone: 692810 pages, LIFO batch:31
233 | Normal zone: 54144 pages used for memmap
234 | Normal zone: 3465216 pages, LIFO batch:31
235 | Reserving Intel graphics memory at 0x00000000ae000000-0x00000000afffffff
236 | ACPI: PM-Timer IO Port: 0x1808
237 | ACPI: Local APIC address 0xfee00000
238 | ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
239 | ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
240 | IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-39
241 | ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
242 | ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
243 | ACPI: IRQ0 used by override.
244 | ACPI: IRQ9 used by override.
245 | Using ACPI (MADT) for SMP configuration information
246 | ACPI: HPET id: 0x8086a301 base: 0xfed00000
247 | smpboot: Allowing 8 CPUs, 4 hotplug CPUs
248 | e820: [mem 0xb0000000-0xf80f7fff] available for PCI devices
249 | Booting paravirtualized kernel on bare hardware
250 | clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6370452778343963 ns
251 | setup_percpu: NR_CPUS:128 nr_cpumask_bits:128 nr_cpu_ids:8 nr_node_ids:1
252 | percpu: Embedded 36 pages/cpu @ffff979acdc00000 s107032 r8192 d32232 u262144
253 | pcpu-alloc: s107032 r8192 d32232 u262144 alloc=1*2097152
254 | pcpu-alloc: [0] 0 1 2 3 4 5 6 7
255 | Built 1 zonelists, mobility grouping on. Total pages: 4096898
256 | Policy zone: Normal
257 | PID hash table entries: 4096 (order: 3, 32768 bytes)
258 | Calgary: detecting Calgary via BIOS EBDA area
259 | Calgary: Unable to locate Rio Grande table in EBDA - bailing!
260 | Memory: 16215128K/16648016K available (6641K kernel code, 1146K rwdata, 2784K rodata, 1312K init, 1008K bss, 432888K reserved, 0K cma-reserved)
261 | SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
262 | ftrace: allocating 29043 entries in 114 pages
263 | Preemptible hierarchical RCU implementation.
264 | RCU restricting CPUs from NR_CPUS=128 to nr_cpu_ids=8.
265 | Tasks RCU enabled.
266 | RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=8
267 | NR_IRQS: 8448, nr_irqs: 760, preallocated irqs: 16
268 | Console: colour dummy device 80x25
269 | console [tty0] enabled
270 | clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 133484882848 ns
271 | hpet clockevent registered
272 | tsc: Fast TSC calibration using PIT
273 | tsc: Detected 2194.919 MHz processor
274 | Calibrating delay loop (skipped), value calculated using timer frequency.. 4391.74 BogoMIPS (lpj=7316396)
275 | pid_max: default: 32768 minimum: 301
276 | ACPI: Core revision 20170728
277 | ACPI: 12 ACPI AML tables successfully acquired and loaded
278 | Security Framework initialized
279 | Yama: becoming mindful.
280 | Dentry cache hash table entries: 2097152 (order: 12, 16777216 bytes)
281 | Inode-cache hash table entries: 1048576 (order: 11, 8388608 bytes)
282 | Mount-cache hash table entries: 32768 (order: 6, 262144 bytes)
283 | Mountpoint-cache hash table entries: 32768 (order: 6, 262144 bytes)
284 | CPU: Physical Processor ID: 0
285 | CPU: Processor Core ID: 0
286 | ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
287 | ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
288 | mce: CPU supports 7 MCE banks
289 | CPU0: Thermal monitoring enabled (TM1)
290 | process: using mwait in idle threads
291 | Last level iTLB entries: 4KB 64, 2MB 8, 4MB 8
292 | Last level dTLB entries: 4KB 64, 2MB 0, 4MB 0, 1GB 4
293 | Freeing SMP alternatives memory: 24K
294 | smpboot: Max logical packages: 4
295 | DMAR: Host address width 39
296 | DMAR: DRHD base: 0x000000fed90000 flags: 0x0
297 | DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e1ff0505e
298 | DMAR: DRHD base: 0x000000fed91000 flags: 0x1
299 | DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c20660462 ecap f010da
300 | DMAR: RMRR base: 0x000000aaf45000 end: 0x000000aaf5bfff
301 | DMAR: RMRR base: 0x000000ad800000 end: 0x000000afffffff
302 | DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
303 | DMAR-IR: HPET id 0 under DRHD base 0xfed91000
304 | DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
305 | DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
306 | DMAR-IR: Enabled IRQ remapping in xapic mode
307 | x2apic: IRQ remapping doesn't support X2APIC mode
308 | ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
309 | TSC deadline timer enabled
310 | Performance Events: PEBS fmt2+, Broadwell events, 16-deep LBR, full-width counters, Intel PMU driver.
311 | ... version: 3
312 | ... bit width: 48
313 | ... generic registers: 4
314 | ... value mask: 0000ffffffffffff
315 | ... max period: 00007fffffffffff
316 | ... fixed-purpose events: 3
317 | ... event mask: 000000070000000f
318 | Hierarchical SRCU implementation.
319 | NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
320 | smp: Bringing up secondary CPUs ...
321 | x86: Booting SMP configuration:
322 | .... node #0, CPUs: #1 #2 #3
323 | smp: Brought up 1 node, 4 CPUs
324 | `
325 |
326 | var BootLog = readLines(bootLog)
327 |
--------------------------------------------------------------------------------
/fixtures/composer.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var composer = `
4 | 2amigos/yii2-date-picker-widget
5 | aws/aws-sdk-php
6 | beberlei/composer-monorepo-plugin
7 | behat/gherkin
8 | bower-asset/ace-builds
9 | bower-asset/bootstrap
10 | bower-asset/bootstrap-datepicker
11 | bower-asset/bootstrap3-dialog
12 | bower-asset/bower-jquery-sparkline
13 | bower-asset/inputmask
14 | bower-asset/jquery
15 | bower-asset/jquery-ui
16 | bower-asset/punycode
17 | bower-asset/typeahead.js
18 | bower-asset/yii2-pjax
19 | cebe/markdown
20 | cmpayments/iban
21 | codeception/codeception
22 | codeception/stub
23 | composer/semver
24 | doctrine/annotations
25 | doctrine/instantiator
26 | doctrine/lexer
27 | donatj/phpuseragentparser
28 | egulias/email-validator
29 | ezyang/htmlpurifier
30 | facebook/webdriver
31 | friendsofphp/php-cs-fixer
32 | frostealth/yii2-aws-s3
33 | fzaninotto/faker
34 | gecko-packages/gecko-php-unit
35 | guzzlehttp/guzzle
36 | guzzlehttp/promises
37 | guzzlehttp/psr7
38 | istvan-ujjmeszaros/bootstrap-duallistbox
39 | jakub-onderka/php-parallel-lint
40 | kartik-v/yii2-dialog
41 | kartik-v/yii2-grid
42 | kartik-v/yii2-krajee-base
43 | kartik-v/yii2-mpdf
44 | kartik-v/yii2-sortable
45 | kartik-v/yii2-sortable-input
46 | kartik-v/yii2-widget-datepicker
47 | kartik-v/yii2-widget-select2
48 | kartik-v/yii2-widget-switchinput
49 | kartik-v/yii2-widget-timepicker
50 | kartik-v/yii2-widget-typeahead
51 | lajax/yii2-translate-manager
52 | latte/latte
53 | linslin/yii2-curl
54 | machour/yii2-sparkline
55 | mpdf/mpdf
56 | mtdowling/jmespath.php
57 | myclabs/deep-copy
58 | nikic/php-parser
59 | paragonie/random_compat
60 | paulthebaud/phpunit-generator
61 | phar-io/manifest
62 | phar-io/version
63 | php-cs-fixer/diff
64 | php-curl-class/php-curl-class
65 | phpdocumentor/reflection-common
66 | phpdocumentor/reflection-docblock
67 | phpdocumentor/type-resolver
68 | phpseclib/mcrypt_compat
69 | phpseclib/phpseclib
70 | phpspec/php-diff
71 | phpspec/prophecy
72 | phpunit/php-code-coverage
73 | phpunit/php-file-iterator
74 | phpunit/php-text-template
75 | phpunit/php-timer
76 | phpunit/php-token-stream
77 | phpunit/phpunit
78 | phpunit/phpunit-mock-objects
79 | psr/http-message
80 | sebastian/code-unit-reverse-lookup
81 | sebastian/comparator
82 | sebastian/diff
83 | sebastian/environment
84 | sebastian/exporter
85 | sebastian/global-state
86 | sebastian/object-enumerator
87 | sebastian/object-reflector
88 | sebastian/recursion-context
89 | sebastian/resource-operations
90 | sebastian/version
91 | setasign/fpdi
92 | smsapi.com/php-client
93 | softark/yii2-dual-listbox
94 | swiftmailer/swiftmailer
95 | symfony/browser-kit
96 | symfony/console
97 | symfony/css-selector
98 | symfony/dom-crawler
99 | symfony/event-dispatcher
100 | symfony/filesystem
101 | symfony/finder
102 | symfony/options-resolver
103 | symfony/polyfill-mbstring
104 | symfony/polyfill-php70
105 | symfony/polyfill-php72
106 | symfony/process
107 | symfony/stopwatch
108 | symfony/var-dumper
109 | symfony/yaml
110 | theseer/tokenizer
111 | trntv/yii2-aceeditor
112 | twig/twig
113 | webmozart/assert
114 | yiier/yii2-slack
115 | yiisoft/yii2
116 | yiisoft/yii2-bootstrap
117 | yiisoft/yii2-composer
118 | yiisoft/yii2-debug
119 | yiisoft/yii2-elasticsearch
120 | yiisoft/yii2-faker
121 | yiisoft/yii2-gii
122 | yiisoft/yii2-httpclient
123 | yiisoft/yii2-jui
124 | yiisoft/yii2-swiftmailer
125 | `
126 |
127 | var Composer = readLines(composer)
128 |
--------------------------------------------------------------------------------
/fixtures/docker_packages.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var dockerPackages = `
4 | couchbase
5 | redis
6 | mongo
7 | nginx
8 | ubuntu
9 | busybox
10 | node
11 | mysql
12 | httpd
13 | hello-world
14 | postgres
15 | alpine
16 | memcached
17 | traefik
18 | mariadb
19 | consul
20 | centos
21 | golang
22 | php
23 | elasticsearch
24 | influxdb
25 | python
26 | haproxy
27 | wordpress
28 | nextcloud
29 | ghost
30 | kong
31 | amazonlinux
32 | eclipse-mosquitto
33 | jenkins
34 | gradle
35 | bash
36 | adminer
37 | redmine
38 | matomo
39 | swift
40 | composer
41 | rust
42 | mediawiki
43 | yourls
44 | cfcommunity/slack-notification-resource
45 | v2tec/watchtower
46 | portainer/portainer
47 | google/cadvisor
48 | kope/protokube
49 | gliderlabs/registrator
50 | kylemanna/openvpn
51 | grafana/grafana
52 | linuxserver/radarr
53 | prom/prometheus
54 | minio/minio
55 | gitlab/gitlab-runner
56 | gliderlabs/logspout
57 | msvechla/vaultbot
58 | cockroachdb/cockroach
59 | linuxserver/ombi
60 | atmoz/sftp
61 | linuxserver/tautulli
62 | bitnami/redis
63 | mesosphere/aws-cli
64 | hashicorp/terraform
65 | linuxkit/kernel
66 | linuxserver/plex
67 | pdffiller/registrator
68 | centurylink/watchtower
69 | bobrik/curator
70 | mobingi/alm-awslogs
71 | buoyantio/linkerd
72 | rancher/agent
73 | istio/mixer
74 | weaveworksdemos/orders
75 | linuxserver/heimdall
76 | homeassistant/home-assistant
77 | drone/drone
78 | circleci/ruby
79 | phpmyadmin/phpmyadmin
80 | pihole/pihole
81 | gogs/gogs
82 | sguha/scripthost
83 | rancher/server
84 | envoyproxy/envoy-alpine
85 | portainer/agent
86 | linuxserver/letsencrypt
87 | avinetworks/se
88 | emby/embyserver
89 | lsiocommunity/organizr
90 | jacobalberty/unifi
91 | skynetservices/skydns
92 | pebbletech/cloudwatch-stats
93 | anchorfree/afmon
94 | wurstmeister/kafka
95 | bekt/logspout-logstash
96 | linuxserver/muximux
97 | selenium/node-chrome
98 | istio/proxy_debug
99 | logdna/logdna-agent
100 | civisanalytics/datascience-r
101 | newrelic/infrastructure
102 | mhart/alpine-node
103 | apicurio/apicurio-studio-ui
104 | openshift/origin-pod
105 | openzipkin/zipkin
106 | gitea/gitea
107 | `
108 |
109 | var DockerPackages = readLines(dockerPackages)
110 |
--------------------------------------------------------------------------------
/fixtures/docker_tags.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var dockerTags = `
4 | 0.1.4.4148
5 | 0.2.26.Final
6 | 0.11.14
7 | 0.34.2-ls29
8 | 1.1.2-centos
9 | 1.1.7
10 | 1.4
11 | 1.4.2
12 | 1.5
13 | 1.5.6
14 | 1.5.14-alpine
15 | 1.6
16 | 1.6.14-alpine
17 | 1.7.3-fpm
18 | 1.7-meta-alpine
19 | 1.8.1
20 | 1.8.5
21 | 1.15
22 | 1.34.2-1-slim
23 | 2.0
24 | 2.3
25 | 2.4
26 | 2.5-node-browsers-legacy
27 | 2.5-node-browsers-stable
28 | 2.5.2b
29 | 2.8.0
30 | 2.12-2.2.0
31 | 3-3.6.8-windowsservercore-ltsc2016
32 | 3.4-xenial
33 | 3.7
34 | 3.141
35 | 3-jdk-7
36 | 4-passenger
37 | 4.0.44
38 | 4.2.0.6
39 | 4.3
40 | 4.7.1-fastcgi
41 | 4.9.175-amd64
42 | 5.0-bionic
43 | 5.0.5
44 | 5.4-jre
45 | 5.4.1-jre8-alpine
46 | 5.5
47 | 5.6
48 | 5.10.23
49 | 6
50 | 6.1.4
51 | 6.7.2
52 | 7.1.29-zts-jessie
53 | 7.3.5-zts-alpine3.8
54 | 7.4-fpm
55 | 8.16.0-jessie
56 | 8-jre-slim
57 | 9
58 | 9.1.17.0-jdk
59 | 10
60 | 10.2.24-bionic
61 | 11
62 | 13-jdk-alpine
63 | 14-fpm
64 | 16.04
65 | 18.04
66 | 132
67 | 2018.03.0.20190212
68 | 7664-5812d7f
69 | amd64-debian-jessie
70 | arm32v7-v2.9.2
71 | arm64v8-0.93.1
72 | arm64v8-5.7.6
73 | armhf-0
74 | edge
75 | fpm-alpine
76 | gclibc
77 | glibc
78 | jre7-alpine
79 | jre8-alpine
80 | jre11
81 | latest
82 | latest-openj8-experimental
83 | latest-openj9-experimental
84 | linux-amd64
85 | lts
86 | nanoserver
87 | php7.1-fpm-alpine
88 | python
89 | rc
90 | slim-12.2.0
91 | stable
92 | stretch
93 | uclibc
94 | v0.31.0
95 | v1.2.11
96 | v1.3.0
97 | v1.7.11-alpine
98 | v1.8
99 | v2.1.29-ls17
100 | v3.10.0
101 | v19.1.1
102 | windowsservercore-1803
103 | windows-amd64
104 | windows-amd64-stable
105 | `
106 |
107 | var DockerTags = readLines(dockerTags)
108 |
--------------------------------------------------------------------------------
/fixtures/extensions.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var extensions = `
4 | gif
5 | webm
6 | mp4
7 | html
8 | php
9 | md
10 | db
11 | png
12 | jpg
13 | ogg
14 | mp3
15 | txt
16 | flac
17 | iso
18 | zip
19 | rar
20 | tar.gz
21 | tar.bz2
22 | tar.xz
23 | deb
24 | rpm
25 | exe
26 | `
27 |
28 | var Extensions = readLines(extensions)
29 |
--------------------------------------------------------------------------------
/fixtures/git.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var gitConsole = `
4 | # How to contribute to the oscar project?
5 |
6 | # 0x00: clone this project
7 | > cd ~/git
8 | > git clone https://github.com/chenjiandongx/oscar.git
9 | Cloning into 'oscar'...
10 | remote: Enumerating objects: 101, done.
11 | remote: Counting objects: 100% (101/101), done.
12 | remote: Compressing objects: 100% (71/71), done.
13 | remote: Total 101 (delta 53), reused 77 (delta 29), pack-reused 0
14 | Receiving objects: 100% (101/101), 244.37 KiB | 23.00 KiB/s, done.
15 | Resolving deltas: 100% (53/53), done.
16 |
17 | # 0x01: upgrade something
18 | > echo "what an awesome project like oscar" >> README.md
19 |
20 | # 0x02: display what you have changed
21 | > git status
22 | On branch oscar-git
23 | Changes not staged for commit:
24 |
25 | (use "git add ..." to update what will be committed)
26 | (use "git checkout -- ..." to discard changes in working directory)
27 |
28 | modified: README.md
29 |
30 | no changes added to commit (use "git add" and/or "git commit -a")
31 |
32 | # 0x03: add commit
33 | > git add . && git commit -m "update readme"
34 | warning: LF will be replaced by CRLF in fixtures/git.go.
35 | The file will have its original line endings in your working directory.
36 | [oscar-git da3d630] update git.go
37 | 1 file changed, 24 insertions(+), 2 deletions(-)
38 |
39 | # 0x04: push it to the remote.
40 | > git push
41 | Enumerating objects: 11, done.
42 | Counting objects: 100% (11/11), done.
43 | Delta compression using up to 12 threads
44 | Compressing objects: 100% (5/5), done.
45 | Writing objects: 100% (6/6), 552 bytes | 552.00 KiB/s, done.
46 | Total 6 (delta 3), reused 0 (delta 0)
47 | To https://github.com/chenjiandongx/oscar.git
48 | 0f96015..7d14615 master -> master
49 |
50 | # 0x05: pr welcome
51 | > echo "oscar!"
52 | `
53 |
54 | var GitConsole = readLines(gitConsole)
55 |
--------------------------------------------------------------------------------
/fixtures/gomod.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var gomod = `
4 | bitbucket.org/bertimus9/systemstat v0.0.0-20180207000608-0eeff89b0690
5 | github.com/Azure/azure-sdk-for-go v43.0.0+incompatible
6 | github.com/Azure/go-autorest/autorest v0.9.6
7 | github.com/Azure/go-autorest/autorest/adal v0.8.2
8 | github.com/Azure/go-autorest/autorest/to v0.2.0
9 | github.com/GoogleCloudPlatform/k8s-cloud-provider v0.0.0-20200415212048-7901bc822317
10 | github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab
11 | github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5
12 | github.com/Microsoft/hcsshim v0.8.10-0.20200715222032-5eafd1556990
13 | github.com/PuerkitoBio/purell v1.1.1
14 | github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
15 | github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7 // indirect
16 | github.com/aws/aws-sdk-go v1.28.2
17 | github.com/blang/semver v3.5.0+incompatible
18 | github.com/boltdb/bolt v1.3.1 // indirect
19 | github.com/caddyserver/caddy v1.0.3
20 | github.com/clusterhq/flocker-go v0.0.0-20160920122132-2b8b7259d313
21 | github.com/codegangsta/negroni v1.0.0 // indirect
22 | github.com/container-storage-interface/spec v1.2.0
23 | github.com/containernetworking/cni v0.8.0
24 | github.com/coredns/corefile-migration v1.0.10
25 | github.com/coreos/go-oidc v2.1.0+incompatible
26 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
27 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
28 | github.com/cpuguy83/go-md2man/v2 v2.0.0
29 | github.com/davecgh/go-spew v1.1.1
30 | github.com/docker/distribution v2.7.1+incompatible
31 | github.com/docker/docker v1.4.2-0.20200309214505-aa6a9891b09c
32 | github.com/docker/go-connections v0.4.0
33 | github.com/docker/go-units v0.4.0
34 | github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153
35 | github.com/emicklei/go-restful v2.9.5+incompatible
36 | github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8
37 | github.com/fsnotify/fsnotify v1.4.9
38 | github.com/go-bindata/go-bindata v3.1.1+incompatible
39 | github.com/go-openapi/analysis v0.19.5
40 | github.com/go-openapi/loads v0.19.4
41 | github.com/go-openapi/spec v0.19.3
42 | github.com/go-openapi/strfmt v0.19.3
43 | github.com/go-openapi/validate v0.19.5
44 | github.com/go-ozzo/ozzo-validation v3.5.0+incompatible // indirect
45 | github.com/gogo/protobuf v1.3.1
46 | github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
47 | github.com/golang/mock v1.3.1
48 | github.com/google/cadvisor v0.37.0
49 | github.com/google/go-cmp v0.4.0
50 | github.com/google/gofuzz v1.1.0
51 | github.com/google/uuid v1.1.1
52 | github.com/googleapis/gnostic v0.4.1
53 | github.com/gorilla/context v1.1.1 // indirect
54 | github.com/hashicorp/golang-lru v0.5.1
55 | github.com/heketi/heketi v9.0.1-0.20190917153846-c2e2a4ab7ab9+incompatible
56 | github.com/heketi/tests v0.0.0-20151005000721-f3775cbcefd6 // indirect
57 | github.com/ishidawataru/sctp v0.0.0-20190723014705-7c296d48a2b5
58 | github.com/json-iterator/go v1.1.10
59 | github.com/libopenstorage/openstorage v1.0.0
60 | github.com/lithammer/dedent v1.1.0
61 | github.com/lpabon/godbc v0.1.1 // indirect
62 | github.com/magiconair/properties v1.8.1 // indirect
63 | github.com/miekg/dns v1.1.4
64 | github.com/moby/ipvs v1.0.1
65 | github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb // indirect
66 | github.com/mrunalp/fileutils v0.0.0-20200520151820-abd8a0e76976
67 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
68 | github.com/mvdan/xurls v1.1.0
69 | github.com/onsi/ginkgo v1.11.0
70 | github.com/onsi/gomega v1.7.0
71 | github.com/opencontainers/go-digest v1.0.0-rc1
72 | github.com/opencontainers/runc v1.0.0-rc91.0.20200707015106-819fcc687efb
73 | github.com/opencontainers/selinux v1.5.2
74 | github.com/pkg/errors v0.9.1
75 | github.com/pmezard/go-difflib v1.0.0
76 | github.com/prometheus/client_golang v1.7.1
77 | github.com/prometheus/client_model v0.2.0
78 | github.com/prometheus/common v0.10.0
79 | github.com/quobyte/api v0.1.2
80 | github.com/robfig/cron v1.1.0
81 | github.com/spf13/afero v1.2.2
82 | github.com/spf13/cobra v1.0.0
83 | github.com/spf13/jwalterweatherman v1.1.0 // indirect
84 | github.com/spf13/pflag v1.0.5
85 | github.com/spf13/viper v1.4.0
86 | github.com/storageos/go-api v0.0.0-20180912212459-343b3eff91fc
87 | github.com/stretchr/testify v1.4.0
88 | github.com/thecodeteam/goscaleio v0.1.0
89 | github.com/urfave/negroni v1.0.0 // indirect
90 | github.com/vishvananda/netlink v1.1.0
91 | github.com/vmware/govmomi v0.20.3
92 | go.etcd.io/etcd v0.5.0-alpha.5.0.20200716221620-18dfb9cca345
93 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
94 | golang.org/x/net v0.0.0-20200707034311-ab3426394381
95 | golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
96 | golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4
97 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0
98 | golang.org/x/tools v0.0.0-20200616133436-c1934b75d054
99 | gonum.org/v1/gonum v0.6.2
100 | gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e // indirect
101 | google.golang.org/api v0.15.1
102 | google.golang.org/grpc v1.27.0
103 | gopkg.in/gcfg.v1 v1.2.0
104 | gopkg.in/square/go-jose.v2 v2.2.2
105 | gopkg.in/yaml.v2 v2.2.8
106 | k8s.io/api v0.0.0
107 | k8s.io/apiextensions-apiserver v0.0.0
108 | k8s.io/apimachinery v0.0.0
109 | k8s.io/apiserver v0.0.0
110 | k8s.io/cli-runtime v0.0.0
111 | k8s.io/client-go v0.0.0
112 | k8s.io/cloud-provider v0.0.0
113 | k8s.io/cluster-bootstrap v0.0.0
114 | k8s.io/code-generator v0.0.0
115 | k8s.io/component-base v0.0.0
116 | k8s.io/cri-api v0.0.0
117 | k8s.io/csi-translation-lib v0.0.0
118 | k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14
119 | k8s.io/heapster v1.2.0-beta.1
120 | k8s.io/klog/v2 v2.2.0
121 | k8s.io/kube-aggregator v0.0.0
122 | k8s.io/kube-controller-manager v0.0.0
123 | k8s.io/kube-openapi v0.0.0-20200427153329-656914f816f9
124 | k8s.io/kube-proxy v0.0.0
125 | k8s.io/kube-scheduler v0.0.0
126 | k8s.io/kubectl v0.0.0
127 | k8s.io/kubelet v0.0.0
128 | k8s.io/legacy-cloud-providers v0.0.0
129 | k8s.io/metrics v0.0.0
130 | k8s.io/sample-apiserver v0.0.0
131 | k8s.io/system-validators v1.1.2
132 | k8s.io/utils v0.0.0-20200729134348-d5654de09c73
133 | sigs.k8s.io/kustomize v2.0.3+incompatible
134 | sigs.k8s.io/yaml v1.2.0
135 | `
136 |
137 | var Gomod = readLines(gomod)
138 |
--------------------------------------------------------------------------------
/fixtures/os_releases.go:
--------------------------------------------------------------------------------
1 | package fixtures
2 |
3 | var osRelease = `
4 | 5.0.7-arch1-1-ARCH
5 | 5.2
6 | 2.6.32-431.el6.i686
7 | 9.0.2.2
8 | 1.5.19(0.150/4/2)
9 | 2.2.1(0.289/5/3)
10 | 3.1.9+
11 | 3.6.11+
12 | 8.0.1-amd64
13 | 2.13-DEVELOPMENT
14 | 6.1-RELEASE-p15
15 | 9.0-RELEASE
16 | 2.6.34-gentoo-r12
17 | 8.11.11
18 | 2.6.35-22-generic
19 | 2.6.38.8-g2593b11
20 | 12.3.0
21 | 3.17.3-1-MANJARO
22 | 2.6.22.5-31-default
23 | 2.6.38-10-generic
24 | 2.6.35.7-unity1
25 | `
26 |
27 | var OsRelease = readLines(osRelease)
28 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/chenjiandongx/oscar
2 |
3 | go 1.13
4 |
5 | require (
6 | github.com/Pallinder/go-randomdata v1.2.0
7 | github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129
8 | github.com/fatih/color v1.9.0
9 | github.com/schollz/progressbar/v3 v3.3.4
10 | github.com/spf13/cobra v1.0.0
11 | github.com/stretchr/testify v1.3.0
12 | )
13 |
--------------------------------------------------------------------------------
/go.sum:
--------------------------------------------------------------------------------
1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3 | github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
4 | github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00lCDlaYPg=
5 | github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y=
6 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
7 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
8 | github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
9 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
10 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
11 | github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4=
12 | github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U=
13 | github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
14 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
15 | github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
16 | github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
17 | github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
18 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
19 | github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
20 | github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
21 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
23 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
24 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
25 | github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
26 | github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
27 | github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
28 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
29 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
30 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
31 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
32 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
33 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
34 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
35 | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
36 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
37 | github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
38 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
39 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
40 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
41 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
42 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
43 | github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
44 | github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
45 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
46 | github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
47 | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
48 | github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
49 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
50 | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
51 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
52 | github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
53 | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
54 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
55 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
56 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
57 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
58 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
59 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
60 | github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
61 | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
62 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
63 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
64 | github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
65 | github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
66 | github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
67 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
68 | github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
69 | github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
70 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
71 | github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
72 | github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
73 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
74 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
75 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
76 | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
77 | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
78 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
79 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
80 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
81 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
82 | github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
83 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
84 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
85 | github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
86 | github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
87 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
88 | github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
89 | github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
90 | github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
91 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
92 | github.com/schollz/progressbar/v3 v3.3.4 h1:nMinx+JaEm/zJz4cEyClQeAw5rsYSB5th3xv+5lV6Vg=
93 | github.com/schollz/progressbar/v3 v3.3.4/go.mod h1:Rp5lZwpgtYmlvmGo1FyDwXMqagyRBQYSDwzlP9QDu84=
94 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
95 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
96 | github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
97 | github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
98 | github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
99 | github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
100 | github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
101 | github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
102 | github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
103 | github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
104 | github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
105 | github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
106 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
107 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
108 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
109 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
110 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
111 | github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
112 | github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
113 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
114 | github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
115 | go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
116 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
117 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
118 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
119 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
120 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
121 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
122 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
123 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
124 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
125 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
126 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
127 | golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
128 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
129 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
130 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
131 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
132 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
133 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
134 | golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
135 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
136 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
137 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
138 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
139 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
140 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
141 | golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
142 | golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
143 | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
144 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
145 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
146 | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
147 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
148 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
149 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
150 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
151 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
152 | google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
153 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
154 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
155 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
156 | gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
157 | gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
158 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
159 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
160 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
161 |
--------------------------------------------------------------------------------
/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "time"
6 |
7 | "github.com/spf13/cobra"
8 |
9 | "github.com/chenjiandongx/oscar/modules"
10 | )
11 |
12 | const version = "0.2.0"
13 |
14 | var rootCmd = &cobra.Command{
15 | Use: "oscar",
16 | Short: "Next generation building tool for nothing",
17 | Version: version,
18 | }
19 |
20 | func NewListCommand() *cobra.Command {
21 | cmd := &cobra.Command{
22 | Use: "list",
23 | Short: "List all available modules",
24 | Run: func(cmd *cobra.Command, args []string) {
25 | for _, m := range modules.Registry {
26 | fmt.Println(" -", m.Name())
27 | }
28 | },
29 | }
30 | return cmd
31 | }
32 |
33 | func NewRunCommand() *cobra.Command {
34 | cmd := &cobra.Command{
35 | Use: "run",
36 | Short: "Run with the specific module",
37 | Run: func(cmd *cobra.Command, args []string) {
38 | if len(args) < 1 {
39 | fmt.Println("> please choose a module to run")
40 | return
41 | }
42 | forever, _ := cmd.Flags().GetBool("forever")
43 | cpu, _ := cmd.Flags().GetBool("cpu")
44 | runCommand(args[0], forever, cpu)
45 | },
46 | Example: " oscar run memdump -f",
47 | }
48 |
49 | cmd.Flags().BoolP("forever", "f", false, "whether to run module forever")
50 | cmd.Flags().BoolP("cpu", "c", false, "whether to make the CPU on the fly")
51 | return cmd
52 | }
53 |
54 | func runCommand(m string, forever, highCpu bool) {
55 | var moduler modules.Moduler
56 | for _, r := range modules.Registry {
57 | if r.Name() == m {
58 | moduler = r
59 | break
60 | }
61 | }
62 |
63 | if moduler == nil {
64 | fmt.Printf("> sorry, [%s] module does not exist\n", m)
65 | return
66 | }
67 |
68 | moduler.Display(highCpu)
69 | if forever {
70 | for {
71 | time.Sleep(time.Second)
72 | moduler.Display(highCpu)
73 | }
74 | }
75 | }
76 |
77 | func init() {
78 | rootCmd.AddCommand(
79 | NewListCommand(),
80 | NewRunCommand(),
81 | )
82 | }
83 |
84 | func main() {
85 | if err := rootCmd.Execute(); err != nil {
86 | fmt.Println("> oh, shit!")
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/modules/bootlog.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "math/rand"
6 | "strings"
7 | "time"
8 |
9 | "github.com/chenjiandongx/oscar/fixtures"
10 | )
11 |
12 | type bootlog struct{}
13 |
14 | func (mod *bootlog) Name() string {
15 | return ModBootlog
16 | }
17 |
18 | func (mod *bootlog) Display(highCpu bool) {
19 | if highCpu {
20 | ctx, cancel := context.WithCancel(context.Background())
21 | go BusyCPUWorking(ctx)
22 | defer func() {
23 | cancel()
24 | time.Sleep(100 * time.Microsecond)
25 | }()
26 | }
27 |
28 | lines := GenIntN(100, 300)
29 | burstMode := false
30 | burstLineCount := 0
31 |
32 | for i := 0; i < lines; i++ {
33 | choice := fixtures.BootLog[rand.Intn(len(fixtures.BootLog))]
34 | lineSleep := GenIntN(10, 1000)
35 | charSleep := 5
36 | burstLine := GenIntN(10, 50)
37 |
38 | if burstMode && burstLineCount < burstLine {
39 | lineSleep = 30
40 | charSleep = 0
41 | } else if burstLineCount == burstLine {
42 | burstMode = false
43 | burstLineCount = 0
44 | } else if !burstMode {
45 | burstMode = GenBool(0.05)
46 | }
47 |
48 | wrong := GenBool(0.01)
49 | if wrong {
50 | PrintlnWithDelay(RedString("ERROR: %s", choice), 10)
51 | } else {
52 | var hasBoldWord = GenBool(0.1)
53 | if hasBoldWord {
54 | words := strings.Split(choice, " ")
55 | PrintWithDelay(BoldString("%s", words[0]), charSleep)
56 | PrintlnWithDelay(choice[len(words[0]):], charSleep)
57 | } else {
58 | PrintlnWithDelay(choice, charSleep)
59 | }
60 | }
61 |
62 | if burstMode {
63 | burstLineCount += 1
64 | }
65 |
66 | time.Sleep(time.Duration(lineSleep) * time.Millisecond)
67 | }
68 | PrintNewline()
69 | }
70 |
71 | func NewBootlogModule() Moduler {
72 | return &bootlog{}
73 | }
74 |
--------------------------------------------------------------------------------
/modules/botnet.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/buger/goterm"
9 | )
10 |
11 | type botnet struct{}
12 |
13 | func (mod *botnet) Name() string {
14 | return ModBotnet
15 | }
16 |
17 | func (mod *botnet) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | var clusters []int
28 | for i := 0; i < GenIntN(8, 16); i++ {
29 | clusters = append(clusters, GenIntN(100, 200))
30 | }
31 |
32 | marker := make([]bool, len(clusters))
33 |
34 | sum := 0
35 | for idx := range clusters {
36 | sum += clusters[idx]
37 | }
38 |
39 | for i := 1; i <= sum; i++ {
40 | fmt.Printf("\rEstablishing connections: %4d/%4d", i, sum)
41 | SleepInMills(3, 6)
42 | }
43 | PrintNewline()
44 | SleepInMills(300, 400)
45 |
46 | for idx, cluster := range clusters {
47 | PrintWithDelay(fmt.Sprintf(" Cluster #%02d (%3d nodes)\n", idx, cluster), 20)
48 | }
49 |
50 | goterm.MoveCursorUp(len(clusters))
51 | goterm.Flush()
52 |
53 | for {
54 | goterm.MoveCursorUp(len(clusters))
55 |
56 | for idx, cluster := range clusters {
57 | status := YellowBoldString("%s", "booting")
58 | if marker[idx] {
59 | status = GreenBoldString("%s", "online ")
60 | } else {
61 | if GenBool(0.04) {
62 | marker[idx] = true
63 | status = GreenBoldString("%s", "online ")
64 | }
65 | }
66 |
67 | fmt.Printf(" Cluster #%02d (%3d nodes) [%s]\n", idx, cluster, status)
68 | }
69 |
70 | all := true
71 | for _, mark := range marker {
72 | if !mark {
73 | all = false
74 | break
75 | }
76 | }
77 |
78 | if all {
79 | break
80 | }
81 |
82 | goterm.Flush()
83 | SleepInMills(100, 200)
84 | }
85 |
86 | tasks := []string{"Synchronizing clocks...", "Sending login information...", "Sending command..."}
87 |
88 | for _, task := range tasks {
89 | SleepInMills(300, 350)
90 | PrintWithDelay(fmt.Sprintf("+ %s", task), 10)
91 | SleepInMills(600, 650)
92 | PrintWithDelay("[done]", 10)
93 | fmt.Println()
94 | }
95 |
96 | PrintWithDelay(">> Botnet update complete.\n", 10)
97 | }
98 |
99 | func NewBotnetModule() Moduler {
100 | return &botnet{}
101 | }
102 |
--------------------------------------------------------------------------------
/modules/cargo.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/chenjiandongx/oscar/fixtures"
9 | )
10 |
11 | type cargo struct{}
12 |
13 | func (mod *cargo) Name() string {
14 | return ModCargo
15 | }
16 |
17 | func (mod *cargo) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | stages := []string{"Downloading", "Compiling"}
28 | output := make([]string, 0)
29 |
30 | for _, idx := range GenRandomIndex(10, 100, len(fixtures.Packages)) {
31 | output = append(output, fmt.Sprintf("%s v%s", fixtures.Packages[idx], GenPackageVersion()))
32 | }
33 |
34 | start := time.Now()
35 | for _, stage := range stages {
36 | for _, o := range output {
37 | PrintGreenWithBold(fmt.Sprintf("%12s ", stage), o)
38 | SleepInMills(200, 2000)
39 | }
40 | }
41 |
42 | PrintGreenWithBold(
43 | fmt.Sprintf("%12s ", "Finished"),
44 | fmt.Sprintf("release [optimized] target(s) in %.2f secs\n", float32(time.Since(start).Milliseconds())/1000.0),
45 | )
46 | PrintNewline()
47 | }
48 |
49 | func NewCargoModule() Moduler {
50 | return &cargo{}
51 | }
52 |
--------------------------------------------------------------------------------
/modules/cc.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "bytes"
5 | "context"
6 | "fmt"
7 | "math/rand"
8 | "sort"
9 | "strings"
10 | "time"
11 |
12 | "github.com/chenjiandongx/oscar/fixtures"
13 | )
14 |
15 | type cc struct{}
16 |
17 | func (mod *cc) Name() string {
18 | return ModCc
19 | }
20 |
21 | func (mod *cc) Display(highCpu bool) {
22 | if highCpu {
23 | ctx, cancel := context.WithCancel(context.Background())
24 | go BusyCPUWorking(ctx)
25 | defer func() {
26 | cancel()
27 | time.Sleep(100 * time.Microsecond)
28 | }()
29 | }
30 |
31 | var (
32 | compilers = []string{"gcc", "clang"}
33 | flagsOpt = []string{"-O0", "-O1", "-O2", "-O3", "-Og", "-Os"}
34 | flagsWarnBase = []string{"-Wall", "-Wall -Wextra"}
35 | flagsWarn = []string{
36 | "-Wno-unused-variable",
37 | "-Wno-sign-compare",
38 | "-Wno-unknown-pragmas",
39 | "-Wno-parentheses",
40 | "-Wundef",
41 | "-Wwrite-strings",
42 | "-Wold-style-definition",
43 | }
44 | flagsF = []string{"-fsigned-char", "-funroll-loops", "-fgnu89-inline", "-fPIC"}
45 | flagsArch = []string{"-march=x86-64", "-mtune=generic", "-pipe"}
46 | flagsDefBase = []string{"-DDEBUG", "-DNDEBUG"}
47 | flagsDef = []string{
48 | "-D_REENTRANT",
49 | "-DMATH_LOOP",
50 | "-D_LIBS_REENTRANT",
51 | "-DNAMESPACE=lib",
52 | "-DMODULE_NAME=lib",
53 | "-DPIC",
54 | "-DSHARED",
55 | }
56 | )
57 |
58 | pkg := fixtures.Packages[GenIntN(1, len(fixtures.Packages))]
59 | cmp := compilers[rand.Intn(len(compilers))]
60 | var cfiles []string
61 | for i := 0; i < GenIntN(300, 1200); i++ {
62 | cfiles = append(cfiles, fixtures.Cfiles[GenIntN(1, len(fixtures.Cfiles))])
63 | }
64 | sort.Strings(cfiles)
65 | opt := flagsOpt[rand.Intn(len(flagsOpt))]
66 | warn := flagsWarnBase[rand.Intn(len(flagsWarnBase))] + GenRandStringFromList(flagsWarn, GenIntN(1, len(flagsWarn)))
67 |
68 | fgs := GenRandStringFromList(flagsF, GenIntN(1, len(flagsF)))
69 | arch := GenRandStringFromList(flagsArch, GenIntN(1, len(flagsArch)))
70 | linkerFlags := GenLinkerFlags(fixtures.Packages, rand.Intn(10))
71 |
72 | includes := GenIncludes(cfiles, 20)
73 |
74 | defs := flagsDefBase[rand.Intn(len(flagsDefBase))] + GenRandStringFromList(flagsDef, GenIntN(1, len(flagsDef)))
75 |
76 | for _, cf := range cfiles {
77 | fmt.Printf(
78 | "%s -c %s %s%s%s %s%s -o %s\n",
79 | cmp, opt, warn, fgs, arch, includes, defs, strings.ReplaceAll(cf, ".c", ".o"),
80 | )
81 | SleepInMills(30, 200)
82 | }
83 |
84 | var buf bytes.Buffer
85 | for _, cf := range cfiles {
86 | buf.WriteString(strings.ReplaceAll(cf, ".c", ".o"))
87 | buf.WriteString(" ")
88 | }
89 |
90 | fmt.Printf("%s -o %s %s%s\n", cmp, pkg, buf.String(), linkerFlags)
91 | SleepInMills(300, 1000)
92 | PrintNewline()
93 | }
94 |
95 | func NewCcModule() Moduler {
96 | return &cc{}
97 | }
98 |
--------------------------------------------------------------------------------
/modules/color.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/fatih/color"
7 | )
8 |
9 | func PrintGreenWithBold(a string, others ...interface{}) {
10 | color.New(color.FgGreen).Add(color.Bold).PrintFunc()(a)
11 | fmt.Println(others...)
12 | }
13 |
14 | func PrintGreen(format string, a ...interface{}) {
15 | color.New(color.FgGreen).PrintfFunc()(fmt.Sprintf(format, a...))
16 | }
17 |
18 | func PrintYellow(format string, a ...interface{}) {
19 | color.New(color.FgYellow).PrintfFunc()(fmt.Sprintf(format, a...))
20 | }
21 |
22 | func CyanBoldString(format string, a ...interface{}) string {
23 | return color.New(color.FgCyan).Add(color.Bold).SprintfFunc()(format, a...)
24 | }
25 |
26 | func GreenBoldString(format string, a ...interface{}) string {
27 | return color.New(color.FgGreen).Add(color.Bold).SprintfFunc()(format, a...)
28 | }
29 |
30 | func YellowBoldString(format string, a ...interface{}) string {
31 | return color.New(color.FgYellow).Add(color.Bold).SprintfFunc()(format, a...)
32 | }
33 |
34 | func MagentaString(format string, a ...interface{}) string {
35 | return color.New(color.FgMagenta).SprintfFunc()(format, a...)
36 | }
37 |
38 | func GreenString(format string, a ...interface{}) string {
39 | return color.New(color.FgGreen).SprintfFunc()(format, a...)
40 | }
41 |
42 | func CyanString(format string, a ...interface{}) string {
43 | return color.New(color.FgCyan).SprintfFunc()(format, a...)
44 | }
45 |
46 | func RedString(format string, a ...interface{}) string {
47 | return color.New(color.FgRed).SprintfFunc()(format, a...)
48 | }
49 |
50 | func BlackString(format string, a ...interface{}) string {
51 | return color.New(color.FgBlack).SprintfFunc()(format, a...)
52 | }
53 |
54 | func BlueString(format string, a ...interface{}) string {
55 | return color.New(color.FgBlue).SprintfFunc()(format, a...)
56 | }
57 |
58 | func BoldString(format string, a ...interface{}) string {
59 | return color.New(color.Bold).SprintfFunc()(format, a...)
60 | }
61 |
--------------------------------------------------------------------------------
/modules/composer.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/chenjiandongx/oscar/fixtures"
9 | )
10 |
11 | type composer struct{}
12 |
13 | func (mod *composer) Name() string {
14 | return ModComposer
15 | }
16 |
17 | func (mod *composer) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | stage := "Installing"
28 |
29 | for _, idx := range GenRandomIndex(10, 100, len(fixtures.Composer)) {
30 | fmt.Printf(" - %s ", stage)
31 | PrintGreen("%s ", fixtures.Composer[idx])
32 | PrintYellow("(%s)", GenPackageVersion())
33 | fmt.Println(": Loading from cache")
34 | SleepInMills(100, 2000)
35 | }
36 |
37 | PrintGreen("Writing lock file\n")
38 | PrintGreen("Generating autoload files\n")
39 | }
40 |
41 | func NewComposerModule() Moduler {
42 | return &composer{}
43 | }
44 |
--------------------------------------------------------------------------------
/modules/cryptomining.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "bytes"
5 | "context"
6 | "fmt"
7 | "math/rand"
8 | "time"
9 | )
10 |
11 | type cryptomining struct{}
12 |
13 | func (mod *cryptomining) Name() string {
14 | return ModCryptomining
15 | }
16 |
17 | func (mod *cryptomining) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | newJobsEveryNLines := GenIntN(20, 50)
28 | remainUntilNewJobs := newJobsEveryNLines
29 |
30 | approximateMhsPerSec := GenIntN(1, 99)
31 | gpuNum := GenIntN(1, 8)
32 |
33 | solutionFoundEveryNLine := GenIntN(80, 200)
34 | remainNextSolution := solutionFoundEveryNLine
35 |
36 | solutionFoundNum := 0
37 | now := time.Now()
38 | for i := 0; i < GenIntN(300, 1000); i++ {
39 | t := MagentaString(time.Now().Format("15:04:05"))
40 | switch {
41 | case remainUntilNewJobs == 0:
42 | remainUntilNewJobs = newJobsEveryNLines
43 |
44 | info := CyanBoldString("ℹ")
45 | fmt.Printf("%-3s %s%s%-20s Received new job #%s seed: #%s target: #%s\n",
46 | info, t, BlackString("|"), BlueString("stratum"), GenHashHex(8), GenHashHex(32), GenHashHex(24),
47 | )
48 |
49 | case remainNextSolution == 0:
50 | remainNextSolution = solutionFoundEveryNLine
51 | solutionFoundNum++
52 |
53 | info := CyanBoldString("ℹ")
54 | fmt.Printf("%-3s %s%s%-20s Solution found; Submitted to stratum.buttcoin.org\n",
55 | info, t, BlueString("|"), BlueString("CUDA0"),
56 | )
57 | fmt.Printf("%-3s %s%s%-20s Nonce: 0x%s\n",
58 | info, t, BlueString("|"), BlueString("CUDA0"), GenHashHex(16),
59 | )
60 | fmt.Printf("%-3s %s%s%-20s %s\n",
61 | info, t, BlueString("|"), BlueString("stratum"), GreenString("Accepted."),
62 | )
63 |
64 | default:
65 | remainUntilNewJobs--
66 | remainNextSolution--
67 |
68 | info := CyanBoldString("m")
69 | var totalMhs float64
70 | var buf bytes.Buffer
71 | for j := 0; j < gpuNum; j++ {
72 | actualMhsPerGpu := float64(approximateMhsPerSec) + rand.Float64()
73 | buf.WriteString(fmt.Sprintf("gpu/%d %s ", j, CyanString(fmt.Sprintf("%.2f", actualMhsPerGpu))))
74 | totalMhs += actualMhsPerGpu
75 | }
76 |
77 | speed := fmt.Sprintf("Speed %s Mhs", CyanBoldString(fmt.Sprintf("%-6.2f", totalMhs)))
78 | duration := time.Since(now)
79 |
80 | hour, minu := int(duration.Hours()), int(duration.Minutes())
81 | fmt.Printf("%-3s %s%s%-18s %s %s [A%d+0:R0+0:F0] Time: %02d:%02d\n",
82 | info, t, BlueString("|"), BlueString("cryptominer"), speed, buf.String(), solutionFoundNum, hour, minu,
83 | )
84 | }
85 |
86 | time.Sleep(300 * time.Millisecond)
87 | }
88 | }
89 |
90 | func NewCryptominingModule() Moduler {
91 | return &cryptomining{}
92 | }
93 |
--------------------------------------------------------------------------------
/modules/docker.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/chenjiandongx/oscar/fixtures"
9 | )
10 |
11 | type docker struct{}
12 |
13 | func (mod *docker) Name() string {
14 | return ModDocker
15 | }
16 |
17 | func (mod *docker) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | for _, idx := range GenRandomIndex(20, 100, len(fixtures.DockerPackages)) {
28 | pack, version := fixtures.DockerPackages[idx], GenPackageTag()
29 | fmt.Printf("Untagged: %s:%s\n", pack, version)
30 | fmt.Printf("Untagged: %s:%s@%s\n", pack, version, GenHashHex(32))
31 |
32 | for i := 0; i < GenIntN(10, 30); i++ {
33 | fmt.Printf("Deleted: sha256:%s\n", GenHashHex(32))
34 | }
35 | SleepInMills(500, 5000)
36 | }
37 | }
38 |
39 | func NewDockerModule() Moduler {
40 | return &docker{}
41 | }
42 |
--------------------------------------------------------------------------------
/modules/download.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | "github.com/schollz/progressbar/v3"
8 | )
9 |
10 | type download struct{}
11 |
12 | func (mod *download) Name() string {
13 | return ModDownload
14 | }
15 |
16 | func (mod *download) Display(highCpu bool) {
17 | if highCpu {
18 | ctx, cancel := context.WithCancel(context.Background())
19 | go BusyCPUWorking(ctx)
20 | defer func() {
21 | cancel()
22 | time.Sleep(100 * time.Microsecond)
23 | }()
24 | }
25 |
26 | count := GenIntN(100, 2000)
27 | bar := progressbar.Default(int64(count))
28 | for i := 0; i < count; i++ {
29 | bar.Add(1)
30 | SleepInMills(50, 200)
31 | }
32 | bar.Clear()
33 | }
34 |
35 | func NewDownloadModule() Moduler {
36 | return &download{}
37 | }
38 |
--------------------------------------------------------------------------------
/modules/generators.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "bytes"
5 | "context"
6 | "crypto/md5"
7 | "fmt"
8 | "math/rand"
9 | "path"
10 | "strings"
11 | "time"
12 |
13 | "github.com/chenjiandongx/oscar/fixtures"
14 | )
15 |
16 | func init() {
17 | rand.Seed(time.Now().UnixNano())
18 | }
19 |
20 | func SleepInMills(min, max int) {
21 | time.Sleep(time.Duration(GenIntN(min, max)) * time.Millisecond)
22 | }
23 |
24 | func GenPackageVersion() string {
25 | return fmt.Sprintf("%d.%d.%d", rand.Intn(4), rand.Intn(12), rand.Intn(10))
26 | }
27 |
28 | func GenRandStringFromList(lst []string, cnt int) string {
29 | var buf bytes.Buffer
30 | for _, idx := range GenRandomIndex(0, len(lst), cnt) {
31 | buf.WriteString(lst[idx])
32 | }
33 | return buf.String()
34 | }
35 |
36 | func GenHTTPCode() int {
37 | codes := []int{200, 201, 400, 401, 403, 404, 500, 502, 503}
38 | if (time.Now().Unix() % 2) == 0 {
39 | return 200
40 | }
41 | return codes[rand.Intn(len(codes))]
42 | }
43 |
44 | func GenHTTPPath(files, exts []string) string {
45 | file := files[rand.Intn(len(files))]
46 | ext := exts[rand.Intn(len(exts))]
47 |
48 | return fmt.Sprintf("/files/%s.%s", file, ext)
49 | }
50 |
51 | func GenLinkerFlags(lst []string, cnt int) string {
52 | var buf bytes.Buffer
53 | for _, idx := range GenRandomIndex(0, len(lst), cnt) {
54 | buf.WriteString("-l")
55 | buf.WriteString(lst[idx])
56 | buf.WriteString(" ")
57 | }
58 | return buf.String()
59 | }
60 |
61 | func GenIncludes(lst []string, cnt int) string {
62 | filter := make(map[string]struct{})
63 | num := 0
64 | for _, l := range lst {
65 | p := path.Base(l)
66 | if _, ok := filter[p]; ok {
67 | continue
68 | }
69 | filter[p] = struct{}{}
70 | num++
71 | if num >= cnt {
72 | break
73 | }
74 | }
75 |
76 | var buf bytes.Buffer
77 | for k := range filter {
78 | buf.WriteString("-I")
79 | buf.WriteString(k)
80 | buf.WriteString(" ")
81 | }
82 |
83 | return buf.String()
84 | }
85 |
86 | func GenPackageTag() string {
87 | return fixtures.DockerTags[rand.Intn(len(fixtures.DockerTags))]
88 | }
89 |
90 | func GenHashHex(n int) string {
91 | key := [64]byte{}
92 | rand.Read(key[:])
93 | return fmt.Sprintf("%x", md5.Sum(key[:]))[:n]
94 | }
95 |
96 | func GenIntN(min, max int) int {
97 | return min + rand.Intn(max-min)
98 | }
99 |
100 | func GenRandomIndex(min, max, length int) []int {
101 | ret := make([]int, 0)
102 | filter := map[int]struct{}{}
103 |
104 | for i := 0; i < GenIntN(min, max); i++ {
105 | for {
106 | idx := rand.Intn(length)
107 | if _, ok := filter[idx]; !ok {
108 | ret = append(ret, idx)
109 | break
110 | }
111 | }
112 |
113 | }
114 |
115 | return ret
116 | }
117 |
118 | func GenBool(p float64) bool {
119 | return float64(time.Now().UnixNano()/100%100)/100.0 < p
120 | }
121 |
122 | func PrintWithDelay(s string, d int) {
123 | for _, r := range []rune(s) {
124 | fmt.Print(string(r))
125 | time.Sleep(time.Duration(d) * time.Millisecond)
126 | }
127 | }
128 |
129 | func PrintlnWithDelay(s string, d int) {
130 | for _, r := range []rune(s) {
131 | fmt.Print(string(r))
132 | time.Sleep(time.Duration(d) * time.Millisecond)
133 | }
134 | fmt.Println()
135 | }
136 |
137 | func PrintNewline() {
138 | fmt.Println()
139 | }
140 |
141 | func genHeader(arch string) string {
142 | rareCmds := []string{"SYSTBL ", "SYSHDR "}
143 | cmds := []string{"WRAP ", "CHK ", "UPD "}
144 |
145 | cmd := cmds[rand.Intn(len(cmds))]
146 | if GenBool(1.0 / 15.0) {
147 | cmd = rareCmds[rand.Intn(len(rareCmds))]
148 | }
149 |
150 | cfiles := fmt.Sprintf("%sh", fixtures.Cfiles[rand.Intn(len(fixtures.Cfiles))])
151 | if strings.HasPrefix(cfiles, "arch") {
152 | items := strings.Split(cfiles, "/")
153 | if len(items) >= 2 {
154 | items[1] = arch
155 | }
156 | cfiles = strings.Join(items, "/")
157 | }
158 |
159 | return fmt.Sprintf(" %s %s", cmd, cfiles)
160 | }
161 |
162 | func genObject(arch string) string {
163 | rareCmds := []string{"HOSTCC ", "AS "}
164 | cmds := []string{"AR ", "CC "}
165 |
166 | cmd := cmds[rand.Intn(len(cmds))]
167 | if GenBool(1.0 / 15.0) {
168 | cmd = rareCmds[rand.Intn(len(rareCmds))]
169 | }
170 |
171 | cfiles := fmt.Sprintf("%sh", fixtures.Cfiles[rand.Intn(len(fixtures.Cfiles))])
172 | if strings.HasPrefix(cfiles, "arch") {
173 | items := strings.Split(cfiles, "/")
174 | if len(items) >= 2 {
175 | items[1] = arch
176 | }
177 | cfiles = strings.Join(items, "/")
178 | }
179 |
180 | return fmt.Sprintf(" %s %s", cmd, cfiles)
181 | }
182 |
183 | func genSpecial(arch string) string {
184 | items := []string{
185 | "HOSTLD arch/ARCH/tools/relocs",
186 | "HOSTLD scripts/mod/modpost",
187 | "MKELF scripts/mod/elfconfig.h",
188 | "LDS arch/ARCH/entry/vdso/vdso32/vdso32.lds",
189 | "LDS arch/ARCH/kernel/vmlinux.lds",
190 | "LDS arch/ARCH/realmode/rm/realmode.lds",
191 | "LDS arch/ARCH/boot/compressed/vmlinux.lds",
192 | "EXPORTS arch/ARCH/lib/lib-ksyms.o",
193 | "EXPORTS lib/lib-ksyms.o",
194 | "MODPOST vmlinux.o",
195 | "SORTEX vmlinux",
196 | "SYSMAP System.map",
197 | "VOFFSET arch/ARCH/boot/compressed/../voffset.h",
198 | "OBJCOPY arch/ARCH/entry/vdso/vdso32.so",
199 | "OBJCOPY arch/ARCH/realmode/rm/realmode.bin",
200 | "OBJCOPY arch/ARCH/boot/compressed/vmlinux.bin",
201 | "OBJCOPY arch/ARCH/boot/vmlinux.bin",
202 | "VDSO2C arch/ARCH/entry/vdso/vdso-image-32.c",
203 | "VDSO arch/ARCH/entry/vdso/vdso32.so.dbg",
204 | "RELOCS arch/ARCH/realmode/rm/realmode.relocs",
205 | "PASYMS arch/ARCH/realmode/rm/pasyms.h",
206 | "XZKERN arch/ARCH/boot/compressed/vmlinux.bin.xz",
207 | "MKPIGGY arch/ARCH/boot/compressed/piggy.S",
208 | "DATAREL arch/ARCH/boot/compressed/vmlinux",
209 | "ZOFFSET arch/ARCH/boot/zoffset.h",
210 | }
211 |
212 | special := items[rand.Intn(len(items))]
213 | special = strings.ReplaceAll(special, "ARCH", arch)
214 |
215 | return fmt.Sprintf(" %s", special)
216 | }
217 |
218 | func GenKernelCompileLine(arch string) string {
219 | switch {
220 | case GenBool(1.0 / 15.9):
221 | return genSpecial(arch)
222 | case GenBool(0.1):
223 | return genHeader(arch)
224 | default:
225 | return genObject(arch)
226 | }
227 | }
228 |
229 | func BusyCPUWorking(ctx context.Context) {
230 | var i int
231 | for {
232 | select {
233 | case <-ctx.Done():
234 | return
235 | default:
236 | i++
237 | i--
238 | time.Sleep(2 << 3 * time.Microsecond)
239 | }
240 | }
241 | }
242 |
--------------------------------------------------------------------------------
/modules/git.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "strings"
6 | "time"
7 |
8 | "github.com/chenjiandongx/oscar/fixtures"
9 | )
10 |
11 | type git struct{}
12 |
13 | func (mod *git) Name() string {
14 | return ModGit
15 | }
16 |
17 | func (mod *git) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | for i := 0; i < len(fixtures.GitConsole); i++ {
28 | if strings.HasPrefix(fixtures.GitConsole[i], "#") {
29 | SleepInMills(500, 600)
30 | PrintWithDelay(GreenString(fixtures.GitConsole[i]+"\n"), 20)
31 | continue
32 | }
33 | PrintWithDelay(fixtures.GitConsole[i]+"\n", 20)
34 | }
35 | }
36 |
37 | func NewGitModule() Moduler {
38 | return &git{}
39 | }
40 |
--------------------------------------------------------------------------------
/modules/gomod.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/chenjiandongx/oscar/fixtures"
9 | )
10 |
11 | type gomod struct{}
12 |
13 | func (mod *gomod) Name() string {
14 | return ModGomod
15 | }
16 |
17 | func (mod *gomod) Display(highCpu bool) {
18 | if highCpu {
19 | ctx, cancel := context.WithCancel(context.Background())
20 | go BusyCPUWorking(ctx)
21 | defer func() {
22 | cancel()
23 | time.Sleep(100 * time.Microsecond)
24 | }()
25 | }
26 |
27 | stages := []string{"finding", "downloading", "extracting"}
28 | output := make([]string, 0)
29 |
30 | for _, idx := range GenRandomIndex(50, 200, len(fixtures.Gomod)) {
31 | output = append(output, fixtures.Gomod[idx])
32 | }
33 |
34 | for _, stage := range stages {
35 | for _, o := range output {
36 | fmt.Printf("go: %s %s\n", stage, o)
37 | SleepInMills(200, 600)
38 | }
39 | }
40 | }
41 |
42 | func NewGomodModule() Moduler {
43 | return &gomod{}
44 | }
45 |
--------------------------------------------------------------------------------
/modules/kernel_compile.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "math/rand"
7 | "time"
8 |
9 | "github.com/chenjiandongx/oscar/fixtures"
10 | )
11 |
12 | type kernelCompile struct{}
13 |
14 | func (mod *kernelCompile) Name() string {
15 | return ModKernelCompile
16 | }
17 |
18 | func (mod *kernelCompile) Display(highCpu bool) {
19 | if highCpu {
20 | ctx, cancel := context.WithCancel(context.Background())
21 | go BusyCPUWorking(ctx)
22 | defer func() {
23 | cancel()
24 | time.Sleep(100 * time.Microsecond)
25 | }()
26 | }
27 |
28 | arch := fixtures.Archs[rand.Intn(len(fixtures.Archs))]
29 | for i := 0; i < GenIntN(100, 600); i++ {
30 | line := GenKernelCompileLine(arch)
31 | fmt.Println(line)
32 | SleepInMills(20, 1000)
33 | }
34 |
35 | fmt.Printf("BUILD arch/%s/boot/bzImage\n\n", arch)
36 |
37 | bs := GenIntN(9000, 1000000)
38 | fmt.Printf("Setup is %d bytes (padded to %d bytes).\n", bs, GenIntN(bs, 1000000))
39 | fmt.Printf("System is %d kB\n", GenIntN(300, 3000))
40 | fmt.Printf("CRC %x\n", GenIntN(0x10000000, 0xffffffff))
41 | fmt.Printf("Kernel: arch/%s/boot/bzImage is ready (#1)\n", arch)
42 | }
43 |
44 | func NewKernelCompileModule() Moduler {
45 | return &kernelCompile{}
46 | }
47 |
--------------------------------------------------------------------------------
/modules/memdump.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "bytes"
5 | "context"
6 | "fmt"
7 | "time"
8 | )
9 |
10 | type memdump struct{}
11 |
12 | func (mod *memdump) Name() string {
13 | return ModMemdump
14 | }
15 |
16 | func (mod *memdump) Display(highCpu bool) {
17 | if highCpu {
18 | ctx, cancel := context.WithCancel(context.Background())
19 | go BusyCPUWorking(ctx)
20 | defer func() {
21 | cancel()
22 | time.Sleep(100 * time.Microsecond)
23 | }()
24 | }
25 |
26 | currentLoc := GenIntN(2<<60, 2<<61)
27 | for i := 0; i < GenIntN(600, 1000); i++ {
28 | var buf bytes.Buffer
29 |
30 | buf.WriteString(fmt.Sprintf("%x ", currentLoc))
31 | currentLoc += 0x10
32 |
33 | var ls []string
34 | for j := 0; j < 16; j++ {
35 | ls = append(ls, GenHashHex(2))
36 | }
37 |
38 | for idx, l := range ls {
39 | if idx == 8 {
40 | buf.WriteString(" ")
41 | }
42 | buf.WriteString(fmt.Sprintf("%s ", l))
43 | }
44 |
45 | buf.WriteString("[")
46 | for j := 0; j < 16; j++ {
47 | if GenIntN(0, 2) == 0 {
48 | buf.WriteString(string(rune(GenIntN(33, 126))))
49 | continue
50 | }
51 | buf.WriteString(".")
52 | }
53 | buf.WriteString("]")
54 |
55 | fmt.Println(buf.String())
56 | SleepInMills(60, 200)
57 | }
58 | }
59 |
60 | func NewMemdumpModule() Moduler {
61 | return &memdump{}
62 | }
63 |
--------------------------------------------------------------------------------
/modules/moduler.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | const (
4 | ModBootlog = "bootlog"
5 | ModBotnet = "botnet"
6 | ModCargo = "cargo"
7 | ModCc = "cc"
8 | ModComposer = "composer"
9 | ModCryptomining = "cryptomining"
10 | ModDocker = "docker"
11 | ModDownload = "download"
12 | ModGit = "git"
13 | ModGomod = "gomod"
14 | ModKernelCompile = "kernel_compile"
15 | ModMemdump = "memdump"
16 | ModWeblog = "weblog"
17 | )
18 |
19 | var Registry = [...]Moduler{
20 | NewBootlogModule(),
21 | NewBotnetModule(),
22 | NewCargoModule(),
23 | NewCcModule(),
24 | NewComposerModule(),
25 | NewCryptominingModule(),
26 | NewDockerModule(),
27 | NewDownloadModule(),
28 | NewGitModule(),
29 | NewGomodModule(),
30 | NewKernelCompileModule(),
31 | NewMemdumpModule(),
32 | NewWeblogModule(),
33 | }
34 |
35 | type Moduler interface {
36 | Name() string
37 | Display(bool)
38 | }
39 |
--------------------------------------------------------------------------------
/modules/moduler_test.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/stretchr/testify/assert"
7 | )
8 |
9 | func TestModuler(t *testing.T) {
10 | assert.True(t, true)
11 | assert.Equal(t, "hi!", "hi!")
12 | assert.NotEqual(t, "Leonardos?", "No!")
13 | }
14 |
--------------------------------------------------------------------------------
/modules/weblog.go:
--------------------------------------------------------------------------------
1 | package modules
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "time"
7 |
8 | "github.com/Pallinder/go-randomdata"
9 |
10 | "github.com/chenjiandongx/oscar/fixtures"
11 | )
12 |
13 | type weblog struct{}
14 |
15 | func (mod *weblog) Name() string {
16 | return ModWeblog
17 | }
18 |
19 | func (mod *weblog) Display(highCpu bool) {
20 | if highCpu {
21 | ctx, cancel := context.WithCancel(context.Background())
22 | go BusyCPUWorking(ctx)
23 | defer func() {
24 | cancel()
25 | time.Sleep(100 * time.Microsecond)
26 | }()
27 | }
28 |
29 | method := "GET"
30 | burstMode := false
31 | burstLineCnt := 0
32 |
33 | for i := 0; i < GenIntN(200, 500); i++ {
34 | ip := randomdata.IpV4Address()
35 | code := GenHTTPCode()
36 | userAgent := randomdata.UserAgentString()
37 | now := time.Now().Format("2006-01-02T15:04:05.000")
38 | path := GenHTTPPath(fixtures.Packages, fixtures.Extensions)
39 |
40 | lineSleep := GenIntN(10, 1000)
41 | burstLine := GenIntN(10, 50)
42 |
43 | if burstMode && burstLineCnt < burstLine {
44 | lineSleep = 30
45 | } else if burstLineCnt == burstLine {
46 | burstMode = false
47 | burstLineCnt = 0
48 | } else if !burstMode {
49 | burstMode = GenBool(0.05)
50 | }
51 |
52 | if burstMode {
53 | burstLineCnt++
54 | }
55 |
56 | fmt.Printf(`%s - [%s] "%s %s HTTP/1.0" %d "%s"%s`, ip, now, method, path, code, userAgent, "\n")
57 | time.Sleep(time.Duration(lineSleep) * time.Millisecond)
58 | }
59 | }
60 |
61 | func NewWeblogModule() Moduler {
62 | return &weblog{}
63 | }
64 |
--------------------------------------------------------------------------------