Skip to content

Commit 81784bd

Browse files
committed
v0.3
1 parent 0b792ac commit 81784bd

File tree

6 files changed

+113
-91
lines changed

6 files changed

+113
-91
lines changed

.github/workflows/pack.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,21 @@ jobs:
1818
- name: Package Application
1919
uses: JackMcKew/pyinstaller-action-windows@main
2020
with:
21-
path: .
21+
path: silent
2222

2323
- name: Upload Artifact
2424
uses: actions/upload-artifact@v2
2525
with:
26-
name: bsod.py
27-
path: dist/windows
26+
name: silent
27+
path: silent/dist/windows
28+
29+
- name: Package Application
30+
uses: JackMcKew/pyinstaller-action-windows@main
31+
with:
32+
path: wizard
33+
34+
- name: Upload Artifact
35+
uses: actions/upload-artifact@v2
36+
with:
37+
name: wizard
38+
path: wizard/dist/windows

.github/workflows/release.yml

+22-11
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,27 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616

17-
- name: Package Application
18-
uses: JackMcKew/pyinstaller-action-windows@main
19-
with:
20-
path: .
21-
22-
- name: Upload Artifact
23-
uses: actions/upload-artifact@v2
24-
with:
25-
name: bsod.py
26-
path: dist/windows
17+
- name: Package Application
18+
uses: JackMcKew/pyinstaller-action-windows@main
19+
with:
20+
path: silent
21+
22+
- name: Upload Artifact
23+
uses: actions/upload-artifact@v2
24+
with:
25+
name: silent
26+
path: silent/dist/windows
27+
28+
- name: Package Application
29+
uses: JackMcKew/pyinstaller-action-windows@main
30+
with:
31+
path: wizard
32+
33+
- name: Upload Artifact
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: wizard
37+
path: wizard/dist/windows
2738

2839
- name: Create Release
2940
id: create_release
@@ -42,7 +53,7 @@ jobs:
4253
env:
4354
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4455
with:
45-
file: "dist/windows/*.exe"
56+
file: "silent/dist/windows/*.exe;wizard/dist/windows/*.exe"
4657
release_id: ${{ steps.create_release.outputs.id }}
4758
overwrite: true
4859
verbose: true

bsod.py renamed to silent/bsod.py

+77-77
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
1-
# A Python script to generate a BSOD.
2-
# This script is based on the following article:
3-
# https://stackoverflow.com/questions/11254763/is-there-a-way-in-windows-to-throw-a-bsod-on-demand-from-python
4-
# https://www.geeksforgeeks.org/how-to-create-a-countdown-timer-using-python/
5-
import os
6-
import sys
7-
import time
8-
9-
if os.name != 'nt':
10-
print("This script is only for Windows.")
11-
sys.exit(1)
12-
13-
14-
def bsod():
15-
"""Generate a BSOD."""
16-
from ctypes import POINTER, byref, c_int, c_uint, c_ulong, windll
17-
18-
nullptr = POINTER(c_int)()
19-
20-
windll.ntdll.RtlAdjustPrivilege(
21-
c_uint(19),
22-
c_uint(1),
23-
c_uint(0),
24-
byref(c_int())
25-
)
26-
27-
windll.ntdll.NtRaiseHardError(
28-
c_ulong(0xC000007B),
29-
c_ulong(0),
30-
nullptr,
31-
nullptr,
32-
c_uint(6),
33-
byref(c_uint())
34-
)
35-
36-
37-
def countdown(t):
38-
"""Countdown timer."""
39-
while t:
40-
mins, secs = divmod(t, 60)
41-
timer = '{:02d}:{:02d}'.format(mins, secs)
42-
print(timer, end="\r")
43-
time.sleep(1)
44-
t -= 1
45-
46-
47-
if __name__ == '__main__':
48-
# Check arguments
49-
if len(sys.argv) != 2:
50-
print("Usage: python3 bsod.py <seconds>")
51-
sys.exit(1)
52-
try:
53-
# Ask for confirmation, comment out if you don't want to ask
54-
'''
55-
print("This will generate a BSOD in {} seconds.".format(sys.argv[1]))
56-
print("Press Ctrl+C to cancel.")
57-
confirmMsg = "Yes, I want to generate a BSOD."
58-
confirmInput = input("Type \""+confirmMsg +
59-
"\" and press Enter to continue: ")
60-
if confirmInput != confirmMsg:
61-
print("Aborted.")
62-
sys.exit(1)
63-
'''
64-
65-
# Get seconds absolute value
66-
seconds = abs(int(sys.argv[1]))
67-
68-
# Countdown
69-
countdown(seconds)
70-
71-
# Generate BSOD
72-
bsod()
73-
print("\nBSOD generated.")
74-
sys.exit(0)
75-
except KeyboardInterrupt:
76-
print("\nAborted.")
77-
sys.exit(1)
1+
# A Python script to generate a BSOD.
2+
# This script is based on the following article:
3+
# https://stackoverflow.com/questions/11254763/is-there-a-way-in-windows-to-throw-a-bsod-on-demand-from-python
4+
# https://www.geeksforgeeks.org/how-to-create-a-countdown-timer-using-python/
5+
import os
6+
import sys
7+
import time
8+
9+
if os.name != 'nt':
10+
print("This script is only for Windows.")
11+
sys.exit(1)
12+
13+
14+
def bsod():
15+
"""Generate a BSOD."""
16+
from ctypes import POINTER, byref, c_int, c_uint, c_ulong, windll
17+
18+
nullptr = POINTER(c_int)()
19+
20+
windll.ntdll.RtlAdjustPrivilege(
21+
c_uint(19),
22+
c_uint(1),
23+
c_uint(0),
24+
byref(c_int())
25+
)
26+
27+
windll.ntdll.NtRaiseHardError(
28+
c_ulong(0xC000007B),
29+
c_ulong(0),
30+
nullptr,
31+
nullptr,
32+
c_uint(6),
33+
byref(c_uint())
34+
)
35+
36+
37+
def countdown(t):
38+
"""Countdown timer."""
39+
while t:
40+
mins, secs = divmod(t, 60)
41+
timer = '{:02d}:{:02d}'.format(mins, secs)
42+
print(timer, end="\r")
43+
time.sleep(1)
44+
t -= 1
45+
46+
47+
if __name__ == '__main__':
48+
# Check arguments
49+
if len(sys.argv) != 2:
50+
print("Usage: python3 bsod.py <seconds>")
51+
sys.exit(1)
52+
try:
53+
# Ask for confirmation, comment out if you don't want to ask
54+
'''
55+
print("This will generate a BSOD in {} seconds.".format(sys.argv[1]))
56+
print("Press Ctrl+C to cancel.")
57+
confirmMsg = "Yes, I want to generate a BSOD."
58+
confirmInput = input("Type \""+confirmMsg +
59+
"\" and press Enter to continue: ")
60+
if confirmInput != confirmMsg:
61+
print("Aborted.")
62+
sys.exit(1)
63+
'''
64+
65+
# Get seconds absolute value
66+
seconds = abs(int(sys.argv[1]))
67+
68+
# Countdown
69+
countdown(seconds)
70+
71+
# Generate BSOD
72+
bsod()
73+
print("\nBSOD generated.")
74+
sys.exit(0)
75+
except KeyboardInterrupt:
76+
print("\nAborted.")
77+
sys.exit(1)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)