Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
fuswim
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sysadmin
fuswim
Commits
97f46205
Commit
97f46205
authored
Jul 22, 2021
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ask what the fuck i should do
parent
f35b9f2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
6 deletions
+36
-6
fuswim
fuswim
+36
-6
No files found.
fuswim
View file @
97f46205
...
...
@@ -42,11 +42,37 @@ interface = "wlan0"
if
sys
.
argv
[
-
1
]
not
in
[
'auto'
,
'boot'
,
sys
.
argv
[
0
]]:
interface
=
sys
.
argv
[
-
1
]
if
not
interface
in
psutil
.
net_if_stats
()
.
keys
():
def
detect_ifaces
():
iplinks
=
sh
(
"/sbin/ip link show"
)
.
split
()
j
,
interfaces
=
1
,[]
for
i
in
range
(
len
(
iplinks
)):
if
iplinks
[
i
]
==
str
(
j
)
+
':'
:
j
=
j
+
1
iface
=
iplinks
[
i
+
1
]
interfaces
.
append
(
iface
[:
-
1
])
return
interfaces
def
checkYN
(
res
,
default
=
'N'
):
if
not
res
:
print
(
' '
+
default
)
res
=
default
if
res
.
lower
()
==
'y'
or
res
.
lower
()
==
'fuck yeah!'
:
return
True
elif
res
.
lower
()
==
'n'
or
res
.
lower
()
==
'fuck no!'
:
return
False
print
(
'WHAT? "'
+
res
+
'"? WHAT THE FUCK? I take it as a fuck no!'
)
return
False
if
not
interface
in
detect_ifaces
():
print
(
"OH FUCK! Interface "
+
interface
+
" doesn't exists. Exiting..."
)
sys
.
exit
(
1
)
# check for wpa_supplicant
wpas
=
False
for
process
in
psutil
.
process_iter
():
...
...
@@ -54,22 +80,26 @@ for process in psutil.process_iter():
if
interface
in
process
.
cmdline
():
wpas
=
True
if
not
wpas
:
if
auto
not
boot
:
if
auto
:
print
(
"fucking wpa_supplicant for "
+
interface
+
" not running, shit loading it... "
)
start_wpa
(
interface
)
else
:
print
(
"fucking wpa_supplicant for "
+
interface
+
" not running, fuck the hell out... "
)
sys
.
exit
(
1
)
else
:
if
psutil
.
net_if_stats
()[
interface
]
.
isup
:
# is interface up?
if
interface
in
psutil
.
net_if_stats
()
.
keys
()
and
psutil
.
net_if_stats
()[
interface
]
.
isup
:
if
boot
:
print
(
"fucking wpa_supplicant for "
+
interface
+
" already fucked, fuck the hell... "
)
sys
.
exit
(
0
)
else
:
print
(
"fucking wpa_supplicant for "
+
interface
+
" already fucked, refucking it"
)
start_wpa
(
interface
)
# non siamo al boot, chiedere!
if
checkYN
(
input
(
"fucking wpa_supplicant for "
+
interface
+
" already fucked and up, should i refuck it? <y|N|fuck yeah!|FUCK NO!> "
)):
print
(
' Ok, fucking it! '
)
start_wpa
(
interface
)
else
:
print
(
"fucking wpa_supplicant for "
+
interface
+
" already fucked, refucking it"
)
# no, it isn't!
print
(
"fucking wpa_supplicant for "
+
interface
+
" already fucked but still down, refucking it"
)
start_wpa
(
interface
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment