Skip to content

Commit

Permalink
Merge pull request #44 from alexmon1989/test_setup_tools
Browse files Browse the repository at this point in the history
Setup tools
  • Loading branch information
AlexNDRmac authored Mar 17, 2022
2 parents 8215fb1 + a481226 commit af384bc
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 58 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ on:

defaults:
run:
shell: bash
shell: pwsh

env:
IMAGE_NAME: alexmon1989/dripper

jobs:
build:
name: Build Docker image
runs-on: ubuntu-20.04
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macos-10.15, windows-2019 ]

steps:
- name: Checkout
Expand All @@ -25,25 +29,44 @@ jobs:
with:
python-version: 3.x

- name: Set environment variables
shell: bash
run: |
# Short name for current branch. For PRs, use target branch (base ref)
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Patch github repo link inside Dockerfile for CI
if: runner.os == 'Linux'
shell: bash
run: |
sed -i "s|\.git|\.git@$GIT_BRANCH|g" Dockerfile
- name: Setup Python packages
run: |
pip install -r requirements.txt
pip install pytest
python3 -m pip install -r requirements.txt
python3 -m pip install pytest
python3 -m pip install --upgrade pip git+https://github.com/alexmon1989/russia_ddos.git@${{ env.GIT_BRANCH }}
- name: Minimalistic CLI check
run: python -u DRipper.py
shell: bash
run: |
dripper --help
- name: Run Tests
run: python3 -m pytest tests/

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
if: runner.os == 'Linux'
id: buildx
uses: docker/setup-buildx-action@v1

- name: Configure Docker metadata
if: runner.os == 'Linux'
id: meta
uses: docker/metadata-action@v3
with:
Expand All @@ -56,42 +79,43 @@ jobs:
type=semver,pattern={{major}}
- name: Login to Docker Hub
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
if: runner.os == 'Linux'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Update Docker Hub Description
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
uses: peter-evans/dockerhub-description@v2
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: alexmon1989/dripper
DOCKERHUB_REPOSITORY: ${{ env.IMAGE_NAME }}

- name: Get the release version
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
id: get-version
run: |
echo ::set-output name=version::${GITHUB_REF#refs/tags/}
- name: Prepare Release Notes
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
run: |
./.github/release-notes.sh ./CHANGELOG.md > ./release-notes.md
- name: Update Release notes
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' }}
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ All notable changes to this project will be documented in this file.
The format based on [Keep a Changelog](https://keepachangelog.com)
and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased](https://github.com/alexmon1989/russia_ddos/compare/2.0.4...HEAD)
## [Unreleased](https://github.com/alexmon1989/russia_ddos/compare/2.1.0...HEAD)


## [v2.1.0](https://github.com/alexmon1989/russia_ddos/compare/2.0.4...2.1.0)

### Added
- Added support for SOCKS5 proxies. (HTTP/TCP only)
- Added possibility to dismiss health check. It is helpful during development.
- Added the possibility to attack random extra_data for HTTP attack (turned off by default).
- Added build tools to create `dripper` executable for Windows/Linux/macOS

### Fixed
- Fixed proxy list params read
Expand Down
19 changes: 1 addition & 18 deletions DRipper.py
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
import sys
import signal
from ripper.services import main


if __name__ == '__main__':
try:
sys.exit(main())
except KeyboardInterrupt: # The user hit Control-C
sys.stderr.write('\n\nReceived keyboard interrupt, terminating.\n\n')
sys.stderr.flush()
# Control-C is fatal error signal 2, for more see
# https://tldp.org/LDP/abs/html/exitcodes.html
sys.exit(128 + signal.SIGINT)
except RuntimeError as exc:
sys.stderr.write(f'\n{exc}\n\n')
sys.stderr.flush()
sys.exit(1)
print('Deprecated. Please, call "dripper ..." instead of "python DRipper.py ..."')
13 changes: 3 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
FROM python:3.10-alpine
ENV PYTHONUNBUFFERED=1

RUN mkdir -p /app/ripper
COPY ./ripper/* /app/ripper/
COPY DRipper.py requirements.txt /app/
RUN apk add curl git && \
pip install --upgrade pip git+https://github.com/alexmon1989/russia_ddos.git

RUN apk add curl && \
pip install --upgrade pip && \
pip install -r /app/requirements.txt && \
rm -rf /app/requirements.txt

WORKDIR /app
ENTRYPOINT ["python", "DRipper.py"]
ENTRYPOINT ["dripper"]
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ This script support HTTP/TCP/UDP flood attack. We recommend using this script fo
DRipper can run on Windows/Linux/macOS from command line.
We recommend to use `PowerShell` for Windows users to run the script, Linux/macOS users can use any shell.
Run `python DRipper --help` to see detailed params description.
Run `dripper --help` to see detailed params description.
```bash
Expand All @@ -84,7 +84,7 @@ It is just like a server testing script and Your IP is visible.

Please, make sure you are ANONYMOUS!

Usage: python DRipper.py [options] arg
Usage: dripper [options] arg

Options:
-h, --help show this help message and exit
Expand All @@ -110,7 +110,7 @@ Options:
-o SOCKET_TIMEOUT, --socket_timeout=SOCKET_TIMEOUT (default: 10 without proxy, 20 with proxy)
Timeout in seconds for socket connection is seconds.

Example: python DRipper.py -s 192.168.0.1 -p 80 -t 100
Example: dripper -s 192.168.0.1 -p 80 -t 100
```

## How to Run
Expand All @@ -136,13 +136,18 @@ Ensure you have Python 3.9 or better installed. Then clone this repo and run DRi
git clone https://github.com/alexmon1989/russia_ddos.git
cd russia_ddos

# Install dependencies
python3 -m pip install --upgrade pip git+https://github.com/alexmon1989/russia_ddos.git
# Run script
dripper -s 127.0.0.1 -p 80 -t 100 -r 1 -m udp


# ===== Alternative variant =====

# Install python dependencies:
pip install -r requirements.txt

# Run script
python -u DRipper.py -s 127.0.0.1 -p 80 -t 100 -r 1 -m udp
# OR
python3 -u DRipper.py -s 127.0.0.1 -p 80 -t 100 -r 1 -m udp
python3 -m ripper.services -s 127.0.0.1 -p 80 -t 100 -r 1 -m udp
```

#### Kubernetes
Expand Down
4 changes: 0 additions & 4 deletions ripper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ def get_no_successful_connection_die_msg() -> str:
f"Your attack is ineffective."


def get_no_more_proxies_msg() -> str:
return f"There are no more operational proxies to work with host."


def readfile(filename: str) -> list[str]:
"""Read string from file"""
with open(filename, 'r') as file:
Expand Down
7 changes: 4 additions & 3 deletions ripper/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
###############################################
# Constants | Logo and help messages
###############################################
VERSION = 'v2.1.0-dev'
USAGE = 'Usage: python %prog [options] arg'
EPILOG = 'Example: python DRipper.py -s 192.168.0.1 -p 80 -t 100'
VERSION = 'v2.1.0'
USAGE = 'Usage: %prog [options] arg'
EPILOG = 'Example: dripper -s 192.168.0.1 -p 80 -t 100'

LOGO_COLOR = f'''[deep_sky_blue1]
██████╗ ██████═╗██╗██████╗ ██████╗ ███████╗██████═╗
Expand Down Expand Up @@ -46,6 +46,7 @@
'Looking for successful proxies.'
YOUR_IP_WAS_CHANGED = 'Your IP was changed!!! Check VPN connection.'
CANNOT_SEND_REQUEST_ERR_MSG = 'Cannot send Request or Packet. Host does not respond.'
NO_MORE_PROXIES_MSG = 'There are no more operational proxies to work with host.'
DEFAULT_CURRENT_IP_VALUE = '...detecting'
HOST_IN_PROGRESS_STATUS = 'HOST_IN_PROGRESS'
HOST_FAILED_STATUS = 'HOST_FAILED'
Expand Down
20 changes: 20 additions & 0 deletions ripper/services.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import signal
import sys
import random
import time
Expand Down Expand Up @@ -216,3 +217,22 @@ def main():
create_thread_pool(_ctx)

statistic.render_statistic(_ctx)


def cli():
try:
sys.exit(main())
except KeyboardInterrupt: # The user hit Control-C
sys.stderr.write('\n\nReceived keyboard interrupt, terminating.\n\n')
sys.stderr.flush()
# Control-C is fatal error signal 2, for more see
# https://tldp.org/LDP/abs/html/exitcodes.html
sys.exit(128 + signal.SIGINT)
except RuntimeError as exc:
sys.stderr.write(f'\n{exc}\n\n')
sys.stderr.flush()
sys.exit(1)


if __name__ == '__main__':
cli()
4 changes: 2 additions & 2 deletions ripper/statistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def refresh(_ctx: Context) -> None:
exit(common.get_no_successful_connection_die_msg())

if _ctx.proxy_manager.proxy_list_initial_len > 0 and len(_ctx.proxy_manager.proxy_list) == 0:
_ctx.add_error(Errors('Host does not respond', common.get_no_more_proxies_msg()))
exit(common.get_no_more_proxies_msg())
_ctx.add_error(Errors('Host does not respond', NO_MORE_PROXIES_MSG))
exit(NO_MORE_PROXIES_MSG)


def render_statistic(_ctx: Context) -> None:
Expand Down
20 changes: 20 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from setuptools import setup, find_packages
from ripper.constants import VERSION

setup(
name='dripper',
version=VERSION,
packages=['ripper'],
install_requires=['rich==12.0.0', 'pysocks==1.7.1'],
package_data={
'ripper': [
'headers.txt',
'useragents.txt',
],
},
entry_points={
'console_scripts': [
'dripper=ripper.services:cli',
],
},
)

0 comments on commit af384bc

Please sign in to comment.