Skip to content

Commit bad8de0

Browse files
authored
Merge pull request #39 from rstalets/main
Display a warning when * is the evil principal
2 parents b74b9a9 + a28e302 commit bad8de0

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed

endgame/command/smash.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from endgame import set_log_level
1212
from endgame.shared.aws_login import get_boto3_client, get_current_account_id
1313
from endgame.shared.validate import click_validate_supported_aws_service, click_validate_user_or_principal_arn, click_validate_comma_separated_resource_names
14-
from endgame.shared import utils, constants
14+
from endgame.shared import utils, constants, scary_warnings
1515
from endgame.command.list_resources import get_all_resources_for_all_services, list_resources_by_service
1616
from endgame.command.expose import expose_service
1717
from endgame.shared.response_message import ResponseMessage
@@ -102,6 +102,12 @@ def smash(service, evil_principal, profile, region, dry_run, undo, cloak, exclud
102102
sts_client = get_boto3_client(profile=profile, service="sts", region=region, cloak=cloak)
103103
current_account_id = get_current_account_id(sts_client=sts_client)
104104
if evil_principal.strip('"').strip("'") == "*":
105+
if not scary_warnings.confirm_anonymous_principal():
106+
utils.print_red("User cancelled, exiting")
107+
exit()
108+
else:
109+
print()
110+
105111
principal_type = "internet-wide access"
106112
principal_name = "*"
107113
else:
@@ -165,3 +171,4 @@ def smash_resource(
165171
current_account_id=current_account_id,
166172
client=client, undo=undo, dry_run=dry_run, evil_principal=evil_principal)
167173
return response_message
174+

endgame/shared/scary_warnings.py

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
from endgame.shared import utils
2+
3+
def confirm_anonymous_principal():
4+
print(r""",,,,,,,,,,''',,'',,,,''''',''''',,,,,,''''''''''''''''''''''''''''''''''''''''..
5+
,,,,,,,,,,'',,,''',,,,,''',,,',;;,,;;:cccc;,''''''''''''''''''''''''''''''''''..
6+
,,,,,,,,,,',,,,,,',,,,,,,,,';cc:,',,,,;;;:cc;,''',''''''''''''''''''''''''''..''
7+
,,,,,,,,,,','',,',,,,,,,,,;lxd;.......'',,col:,',,''''''''''''''''''''''''''''''
8+
,,,,,,,,,,,,,',,,,,,,,,,;oOkoo;..........'',,:;,,,,'''''''''''''''''''''''''''''
9+
,,,,,,,,,,,,,,,,,,,,,,,:xKKx:::.............',,,,,,,,'''''''''''''''''''''''''''
10+
,,,,,,,,,,,,,,,,,,,,,,,l00k:.,c;............',',,,,,,,,,,,,,,,''''''''''''''',''
11+
,,,,,,,,,,,,,,,,,,,,,,:dOx:.'cl:'...........,;,,,,,,,,,,,,,,,,,,,,,'''''''''''''
12+
,,,,,,,,,,,,,,,,,,,;;clod;.,:c;,............';,,,,,,,,,,,,,,,,,,,,,,,,,,''''''''
13+
,,;;,,,,,,,,,,;;,,;;ckocl;;cc;'.............,:;;;;;,,,,,,,,,,,,,,,,,,,,,'''',,,,
14+
,;;,,,,,,;;;;;;;;;::dKOl;,cc,'.............',,;;;;;;;;;;;;,,,,,,,,,,,,,,,,,,,,,,
15+
;;;;;;;;;;;;;;;;:::o0KOx:'','............,;',;;;;;;;;;;;;;;,,,,,,,,,,,,,,,,,,,,,
16+
;;;;;;;;;;;;;;::::lkK0kdl;'..............';::::::::;;;;;;;;;;;,,,,,,,,,,,,,,,,,,
17+
;;;;;;;;;;;;;;:::cxKKOdoc,,'..............,oo:::::::::::;;;;;;;;,,,,,,,,,,,,,,,,
18+
;;,,;;;;;;;;::::clO0kool::lc;.............,llldxxdolc::::;;;;;;;;;;;,,;;;;;;;;;;
19+
,,,,,;;;;;;;:::cldOOkxkkkkOx;..';ccccc::::lodddxkkkdc::::;;;;;;;;;;;;;;;;;;;;;;;
20+
,,,,,,;;;;;:::coxxxxxxdllc:'.,:coooollclooc:::;,,,,,,:ccclc:;;;;;;;;;;;;;;;;;;;;
21+
,,,,,;;;;:::::ccc:;:::;'.....'clllllcc:;,'........';cc;:ddc:cc:;;;;;;;;;;;;;;;;;
22+
,,,,;;;:::cccc:''''''''......';c:,,'''..................,'..';cc:;;;;;;;;;;;;;;;
23+
,,;;;::::cllc:;'............''.''...'.........................,:::::::;;;;;;;;;;
24+
,;;;::::cddc'.''..............................................;:::cc::::::::::;;
25+
;;;:::ccdOl,..,,.......''....................................',';clccccccc::::::
26+
;:::ccclkdoxc'...............................................'..;lollllccccc::::
27+
ccclllokk:cxo:..',,'............................................:ooollllcccc::::
28+
loooddk0d:odc:lddo:,.......................''..................,odooolllcccccc::
29+
odddxO0xol;',col:;'...................''',okl..................cxdoooollllcccccc
30+
ddxxOKko:'..,'............''........::;;;cxOl.................'dxddddooollllcccc
31+
ddk0KKd;..,;,..............'','..'';cddllxK0d'................:kxdddddooollllccc
32+
xk00Oo::;.';,..............''',,'';c;lxl:lO0;.................:kkxxdddooolllcccc
33+
OKOko,;l;...................''',;;,,;::;;,:c'..................ckxxxdddooollcccc
34+
Oxxxo;,'......................''',;;;,''.''....................'okxxxdddoollcccc
35+
ddkOkc............................',''''...'....................;okxxdddoollcccc
36+
cool;...............................:dl..........................,ldxddooollcccc
37+
..................................,lO0x,..........................,lxddooolllccc
38+
c:,..............';;'..............,c;.............................;oxddooolllcc
39+
;'...............';,...............................................:dxxddoollllc
40+
....................'''.'c:.................'......................,lxxxddoollcc
41+
..''.................','lkl'.................'.................'....',:ldddolllc
42+
...'...............''..'cc'..................''..............',,,......'cddoollc
43+
,...................''........................'.............''''','.....cddoollc
44+
.................................................................',.....cddoolll
45+
.................................................................''''..'oxddoool
46+
...................................................................',,,lkxxxddoo
47+
..................................................................'',lxkkxxxxddd
48+
.........................................';:c'....................'''cxkkxxxxddd
49+
....................................',,'..',:'.....................,',lxxxxxxddd
50+
......................','''''.',,,,',;:,...'.......................,;,;oxxxddddd
51+
......................',,,,'''',,,,,;;;,'....':;'''................'c;;dxxxddddd
52+
......................',,,,,,;;,'''..',,,....'::,,,,'..............'lclxxxdddddd
53+
'......................',,,,,,:l:,'''.','.....','..''..............,oxxxxxxddddd
54+
''......................,,,,,,',;;,,,''''.......'''''..............'okkkxxxxxdxd
55+
'........................''',,,,,''',''...........'''.'....''''....':dkkkxxxxxxd
56+
'..............................'''....'............'..............''':xkkxxxxxdd
57+
...............................................,;,,''..............'',lxxxxxxxdd
58+
,''.........................'...................'',,''..........''..''cxxxxxxxdd
59+
,..''.........................................'..''''''...............;oxxxxxxxd
60+
;,'...............................................'''''....'''....'...,lxxxxxxxd
61+
kdl:,'.........................................''...'......','..''....'cxxxxxxxx
62+
do;','..........................................''...........''........;dxxxxxxx
63+
::::'..'....................................................'''.......'lkkkxxkkx
64+
:llcc,',;:,................................................''........':xOkkkkkkk
65+
:lxc,lc'':c;.........................................................:lokOOOOOkk
66+
::ld:,ll:;::,........................................................,c:lkkkkkkk
67+
::;lxocc:::;,,'...........................'...........................',,lxkkkkk
68+
;;;:dOkd;:o;,''........................................................',:dxkkkO
69+
,,,;cxkkc:lc:'.''''.....................................................';odxkkO
70+
,,,,;lkkd::oc,''........................'.................................;oodxk
71+
,,,,,cOOxlcdddol,..........................................................,llll
72+
,,,,,ckkkocc;coc,...........................................................co:;
73+
,,,,,cxdoxOd:okxc.......................................................... 'dl; """)
74+
print("\n")
75+
utils.print_red("WARNING:")
76+
confirm = input("You are about to expose resources to the ENTIRE INTERNET. Are you sure you want to do that? [y/N]")
77+
if confirm.lower() == 'y':
78+
return True
79+
else:
80+
return False

0 commit comments

Comments
 (0)