├── CA └── .gitkeep ├── ftp-server ├── ssl │ └── .gitkeep └── Dockerfile ├── herd-view ├── ssl │ └── .gitkeep ├── src │ ├── assets │ │ ├── .gitkeep │ │ └── images │ │ │ ├── asset.png │ │ │ ├── redherd.png │ │ │ ├── footer_logo.png │ │ │ └── terminal_placeholder.png │ ├── app │ │ ├── app.component.css │ │ ├── controls │ │ │ ├── ca-downloader │ │ │ │ ├── ca-downloader.component.css │ │ │ │ ├── ca-downloader.component.html │ │ │ │ ├── ca-downloader.component.ts │ │ │ │ └── ca-downloader.component.spec.ts │ │ │ ├── login-panel │ │ │ │ ├── login-panel.component.html │ │ │ │ ├── login-panel.component.ts │ │ │ │ ├── login-panel.component.css │ │ │ │ └── login-panel.component.spec.ts │ │ │ ├── module-output-panel │ │ │ │ ├── module-output-panel.component.css │ │ │ │ ├── module-output-panel.component.html │ │ │ │ └── module-output-panel.component.spec.ts │ │ │ ├── module-wrapper │ │ │ │ ├── module-wrapper.component.html │ │ │ │ ├── module-wrapper.component.spec.ts │ │ │ │ └── module-wrapper.component.css │ │ │ ├── asset-process-panel │ │ │ │ ├── asset-process-panel.component.css │ │ │ │ └── asset-process-panel.component.spec.ts │ │ │ ├── module-process-panel │ │ │ │ ├── module-process-panel.component.css │ │ │ │ └── module-process-panel.component.spec.ts │ │ │ ├── asset-module-panel │ │ │ │ ├── asset-module-panel.component.css │ │ │ │ └── asset-module-panel.component.spec.ts │ │ │ ├── asset-topic-panel │ │ │ │ ├── asset-topic-panel.component.css │ │ │ │ └── asset-topic-panel.component.spec.ts │ │ │ ├── module-asset-panel │ │ │ │ ├── module-asset-panel.component.css │ │ │ │ └── module-asset-panel.component.spec.ts │ │ │ ├── processes-table │ │ │ │ ├── processes-table.component.css │ │ │ │ └── processes-table.component.spec.ts │ │ │ ├── terminal │ │ │ │ ├── terminal.component.html │ │ │ │ ├── terminal.component.spec.ts │ │ │ │ └── terminal.component.css │ │ │ ├── filemanager │ │ │ │ ├── filemanager.component.css │ │ │ │ ├── filemanager.component.spec.ts │ │ │ │ ├── filemanager.component.html │ │ │ │ └── filemanager.component.ts │ │ │ ├── module-tab │ │ │ │ ├── module-tab.component.spec.ts │ │ │ │ └── module-tab.component.css │ │ │ ├── modules-table │ │ │ │ ├── modules-table.component.css │ │ │ │ └── modules-table.component.spec.ts │ │ │ ├── module-panel │ │ │ │ ├── module-panel.component.css │ │ │ │ └── module-panel.component.spec.ts │ │ │ ├── assets-board │ │ │ │ ├── assets-board.component.spec.ts │ │ │ │ └── assets-board.component.css │ │ │ ├── login-form │ │ │ │ ├── login-form.component.spec.ts │ │ │ │ ├── login-form.component.css │ │ │ │ ├── login-form.component.html │ │ │ │ └── login-form.component.ts │ │ │ ├── asset-panel │ │ │ │ ├── asset-panel.component.spec.ts │ │ │ │ └── asset-panel.component.css │ │ │ ├── modules-board │ │ │ │ ├── modules-board.component.spec.ts │ │ │ │ └── modules-board.component.css │ │ │ ├── asset-detail-panel │ │ │ │ ├── asset-detail-panel.component.spec.ts │ │ │ │ └── asset-detail-panel.component.css │ │ │ ├── nav-bar │ │ │ │ ├── nav-bar.component.css │ │ │ │ ├── nav-bar.component.ts │ │ │ │ └── nav-bar.component.spec.ts │ │ │ └── assets-table │ │ │ │ ├── assets-table.component.css │ │ │ │ └── assets-table.component.spec.ts │ │ ├── bin │ │ │ ├── model │ │ │ │ ├── user.ts │ │ │ │ ├── system.ts │ │ │ │ ├── topic.ts │ │ │ │ ├── type.ts │ │ │ │ ├── process.ts │ │ │ │ ├── asset.ts │ │ │ │ ├── service.ts │ │ │ │ ├── base │ │ │ │ │ └── redherd-common.ts │ │ │ │ └── module.ts │ │ │ ├── proto │ │ │ │ ├── lv1-message.ts │ │ │ │ └── lv2-message.ts │ │ │ ├── auth │ │ │ │ ├── auth.guard.spec.ts │ │ │ │ ├── auth.service.spec.ts │ │ │ │ └── auth.guard.ts │ │ │ └── gui │ │ │ │ └── display.ts │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── services │ │ │ ├── filemanager.service.ts │ │ │ ├── type.service.spec.ts │ │ │ ├── asset.service.spec.ts │ │ │ ├── topic.service.spec.ts │ │ │ ├── module.service.spec.ts │ │ │ ├── system.service.spec.ts │ │ │ ├── process.service.spec.ts │ │ │ ├── socket-io.service.spec.ts │ │ │ ├── tcp-proxy.service.spec.ts │ │ │ ├── terminal.service.spec.ts │ │ │ ├── udp-proxy.service.spec.ts │ │ │ ├── web-proxy.service.spec.ts │ │ │ ├── filemanager.service.spec.ts │ │ │ ├── rtsp-redirector.service.spec.ts │ │ │ ├── socket-io.service.ts │ │ │ ├── base │ │ │ │ ├── redherd-web.ts │ │ │ │ └── redherd-auth-provider.ts │ │ │ ├── terminal.service.ts │ │ │ ├── rtsp-redirector.service.ts │ │ │ ├── tcp-proxy.service.ts │ │ │ ├── udp-proxy.service.ts │ │ │ ├── web-proxy.service.ts │ │ │ ├── system.service.ts │ │ │ └── process.service.ts │ │ ├── app.component.spec.ts │ │ └── app-routing.module.ts │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── ng-favicon.ico │ ├── main.ts │ ├── index.html │ ├── styles.css │ ├── test.ts │ └── main.scss ├── .dockerignore ├── tsconfig.app.json ├── e2e │ ├── tsconfig.json │ ├── src │ │ ├── app.po.ts │ │ └── app.e2e-spec.ts │ └── protractor.conf.js ├── .editorconfig ├── Dockerfile ├── tsconfig.spec.json ├── conf │ └── herdview.conf ├── .browserslistrc ├── tsconfig.json ├── .gitignore └── karma.conf.js ├── distrib-server ├── auth │ └── .gitkeep ├── conf │ └── .gitkeep ├── ssl │ └── .gitkeep └── Dockerfile ├── herd-server ├── etc │ ├── .gitkeep │ └── .dockerignore ├── key │ └── .gitkeep ├── ssl │ └── .gitkeep ├── models │ ├── data │ │ └── .gitkeep │ ├── rdhd-mdl-user_mapper.js │ ├── rdhd-mdl-user_gateway.js │ ├── rdhd-mdl-process_mapper.js │ ├── rdhd-mdl-type_mapper.js │ ├── rdhd-mdl-topic_mapper.js │ ├── rdhd-mdl-system_mapper.js │ ├── rdhd-mdl-asset_mapper.js │ ├── rdhd-mdl-module_mapper.js │ ├── rdhd-mdl-system_gateway.js │ ├── rdhd-mdl-type_gateway.js │ ├── rdhd-mdl-topic_gateway.js │ ├── base │ │ └── rdhd-mdl-data_mapper.js │ ├── rdhd-mdl-assets_topics_gateway.js │ ├── rdhd-mdl-assets_topics_mapper.js │ ├── rdhd-mdl-asset_gateway.js │ ├── rdhd-mdl-sqlite_connection_broker.js │ └── rdhd-mdl-process_gateway.js ├── .dockerignore ├── public │ ├── centos.png │ ├── debian.png │ ├── macos.png │ ├── android.png │ └── windows.png ├── bin │ ├── module │ │ └── collection │ │ │ ├── debian_sync_ftp_files.info │ │ │ ├── windows_sync_ftp_files.info │ │ │ ├── debian_sync_asset_files.info │ │ │ ├── windows_ipconfig.info │ │ │ ├── windows_sync_asset_files.info │ │ │ ├── debian_interfaces.info │ │ │ ├── debian_ping.info │ │ │ ├── windows_ping.info │ │ │ ├── centos_ping.info │ │ │ ├── debian_wifi_interfaces.info │ │ │ ├── android_ping.info │ │ │ ├── debian_persistent_ping.info │ │ │ ├── debian_traceroute.info │ │ │ ├── windows_traceroute.info │ │ │ ├── windows_persistent_ping.info │ │ │ ├── centos_persistent_ping.info │ │ │ ├── debian_gophish.info │ │ │ ├── windows_push_file_to_ftp.info │ │ │ ├── debian_guacamole.info │ │ │ ├── debian_push_file_to_ftp.info │ │ │ ├── debian_pull_file_from_ftp.info │ │ │ ├── windows_gophish.info │ │ │ ├── windows_pull_file_from_ftp.info │ │ │ ├── debian_covenant.info │ │ │ ├── debian_nmap_pingsweep.info │ │ │ ├── debian_rtsp_cam.info │ │ │ ├── debian_set.info │ │ │ ├── windows_nmap_pingsweep.info │ │ │ ├── debian_motion_cam.info │ │ │ ├── debian_metasploit.info │ │ │ ├── debian_theharvester.info │ │ │ ├── debian_airgeddon.info │ │ │ ├── windows_metasploit.info │ │ │ ├── debian_wifiphisher.info │ │ │ ├── windows_defender.info │ │ │ ├── debian_wpscan.info │ │ │ ├── debian_nikto.info │ │ │ ├── debian_nmap_tcp.info │ │ │ ├── debian_nmap_udp.info │ │ │ ├── windows_download_file.info │ │ │ ├── windows_nmap_tcp.info │ │ │ ├── windows_nmap_udp.info │ │ │ ├── debian_ap_scan.info │ │ │ ├── debian_monitor_mode.info │ │ │ ├── debian_dirb.info │ │ │ ├── macos_transfer.info │ │ │ ├── android_transfer.info │ │ │ ├── debian_transfer.info │ │ │ ├── windows_transfer.info │ │ │ ├── debian_hping3_synflood.info │ │ │ ├── debian_nc_listener.info │ │ │ ├── debian_tcpdump_interface.info │ │ │ ├── debian_john_wordlist.info │ │ │ ├── debian_hydra.info │ │ │ ├── windows_ipconfig.js │ │ │ ├── windows_powerview_forest.info │ │ │ ├── debian_interfaces.js │ │ │ ├── windows_powerview_domain_computers.info │ │ │ ├── windows_powerview_domain.info │ │ │ ├── windows_powerview_domain_users.info │ │ │ ├── debian_wifi_interfaces.js │ │ │ ├── android_ping.js │ │ │ ├── windows_sync_ftp_files.js │ │ │ ├── windows_sync_asset_files.js │ │ │ ├── debian_sync_ftp_files.js │ │ │ ├── debian_sync_asset_files.js │ │ │ └── windows_persistent_ping.js │ ├── lib │ │ ├── base │ │ │ └── rdhd-lib-service_finalizer.js │ │ ├── rdhd-lib-file_manager_factory.js │ │ ├── rdhd-lib-tcp_proxy_factory.js │ │ ├── rdhd-lib-udp_proxy_factory.js │ │ └── rdhd-lib-rtsp_redirector_factory.js │ └── job │ │ ├── rdhd-job-rtsp_redirector.js │ │ ├── base │ │ ├── rdhd-job-base_macos_job.js │ │ ├── rdhd-job-base_android_job.js │ │ ├── rdhd-job-base_centos_job.js │ │ ├── rdhd-job-base_debian_job.js │ │ ├── rdhd-job-base_job.js │ │ └── rdhd-job-base_unix_job.js │ │ ├── rdhd-job-tcp_proxy.js │ │ ├── rdhd-job-udp_proxy.js │ │ └── rdhd-job-process_monitor.js ├── controllers │ ├── rdhd-ctr-tcp_proxy_controller.js │ ├── rdhd-ctr-udp_proxy_controller.js │ ├── rdhd-ctr-web_proxy_controller.js │ ├── rdhd-ctr-processes_monitor_controller.js │ ├── rdhd-ctr-file_manager_controller.js │ └── rdhd-ctr-system_controller.js ├── proto │ ├── rdhd-prt-fsmfp_messages.js │ ├── rdhd-prt-jsend_responses.js │ └── rdhd-prt-fsmfp_utils.js ├── package.json └── Dockerfile ├── etc ├── node-file-manager │ ├── node-file-manager.sh │ ├── run.sh │ ├── lib │ │ ├── fileMap.js │ │ ├── tools.js │ │ └── public │ │ │ └── css │ │ │ └── custom.css │ ├── LICENSE │ └── package.json └── initialize-db │ ├── run.sh │ └── package.json ├── ovpn-server ├── bin │ ├── ovpn_status │ ├── ovpn_getclient_all │ ├── easyrsa_vars │ ├── ovpn_otp_user │ ├── ovpn_copy_server_files │ └── ovpn_initpki ├── init │ └── upstart.init ├── otp │ └── openvpn ├── LICENSE ├── Dockerfile └── Dockerfile.aarch64 ├── .github └── workflows │ └── build.yml ├── utils └── install_docker.sh ├── LICENSE └── .gitignore /CA/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ftp-server/ssl/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-view/ssl/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /distrib-server/auth/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /distrib-server/conf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /distrib-server/ssl/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/etc/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/key/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/ssl/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/models/data/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-view/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-view/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/etc/.dockerignore: -------------------------------------------------------------------------------- 1 | .gitkeep 2 | -------------------------------------------------------------------------------- /distrib-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:latest 2 | -------------------------------------------------------------------------------- /herd-view/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | node_modules 3 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/ca-downloader/ca-downloader.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /herd-server/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | node_modules 3 | bin/module/collection 4 | models/data -------------------------------------------------------------------------------- /herd-view/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/user.ts: -------------------------------------------------------------------------------- 1 | export interface User { 2 | username: string; 3 | password: string; 4 | } -------------------------------------------------------------------------------- /herd-view/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/favicon.ico -------------------------------------------------------------------------------- /herd-server/public/centos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-server/public/centos.png -------------------------------------------------------------------------------- /herd-server/public/debian.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-server/public/debian.png -------------------------------------------------------------------------------- /herd-server/public/macos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-server/public/macos.png -------------------------------------------------------------------------------- /herd-view/src/ng-favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/ng-favicon.ico -------------------------------------------------------------------------------- /herd-server/public/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-server/public/android.png -------------------------------------------------------------------------------- /herd-server/public/windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-server/public/windows.png -------------------------------------------------------------------------------- /herd-view/src/assets/images/asset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/assets/images/asset.png -------------------------------------------------------------------------------- /herd-view/src/assets/images/redherd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/assets/images/redherd.png -------------------------------------------------------------------------------- /etc/node-file-manager/node-file-manager.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | SHELL_PATH=`dirname $0` 4 | cd $SHELL_PATH/lib 5 | 6 | node --harmony index.js $* 7 | -------------------------------------------------------------------------------- /herd-view/src/assets/images/footer_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/assets/images/footer_logo.png -------------------------------------------------------------------------------- /herd-view/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /herd-view/src/assets/images/terminal_placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redherd-project/redherd-framework/HEAD/herd-view/src/assets/images/terminal_placeholder.png -------------------------------------------------------------------------------- /herd-view/src/app/bin/proto/lv1-message.ts: -------------------------------------------------------------------------------- 1 | export interface Lv1Message { 2 | id: string; 3 | type: string; 4 | timestamp: number; 5 | content: string; 6 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-panel/login-panel.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
-------------------------------------------------------------------------------- /herd-view/src/app/bin/model/system.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | 3 | export interface System extends RedHerdObject { 4 | seed: string; 5 | dob: string; 6 | } -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/topic.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | 3 | export interface Topic extends RedHerdObject { 4 | name: string; 5 | description: string; 6 | } -------------------------------------------------------------------------------- /ftp-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM stilliard/pure-ftpd:latest 2 | 3 | # https://github.com/stilliard/docker-pure-ftpd 4 | # https://hub.docker.com/r/stilliard/pure-ftpd 5 | 6 | RUN mkdir -p /etc/ssl/private 7 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/type.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | 3 | export interface Type extends RedHerdObject { 4 | name: string; 5 | description: string; 6 | } -------------------------------------------------------------------------------- /etc/initialize-db/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /home/node/app 4 | 5 | echo "Installing initialize-db packages" 6 | npm install 7 | 8 | echo "Initializing database" 9 | node ./initialize-db.js 10 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-output-panel/module-output-panel.component.css: -------------------------------------------------------------------------------- 1 | .terminal-wrapper { 2 | background-color: black; 3 | display: block; 4 | padding-left: 5px; 5 | height: 55vh; 6 | } -------------------------------------------------------------------------------- /ovpn-server/bin/ovpn_status: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Get OpenVPN server status 5 | # 6 | if [ "$DEBUG" == "1" ]; then 7 | set -x 8 | fi 9 | 10 | set -e 11 | 12 | tail -F /tmp/openvpn-status.log 13 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-output-panel/module-output-panel.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
-------------------------------------------------------------------------------- /herd-view/src/app/bin/model/process.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | 3 | export interface Process extends RedHerdObject { 4 | module: string; 5 | session: string; 6 | id_asset: number; 7 | } -------------------------------------------------------------------------------- /herd-view/src/app/bin/proto/lv2-message.ts: -------------------------------------------------------------------------------- 1 | import { Lv1Message } from "./lv1-message" 2 | 3 | export interface Lv2Message { 4 | src: string; 5 | dst: string; 6 | type: string; 7 | session: string; 8 | payload: Lv1Message 9 | } -------------------------------------------------------------------------------- /etc/node-file-manager/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /home/node/app 4 | 5 | echo "Installing node-file-manger packages" 6 | npm install 7 | 8 | echo "Installing pkg package" 9 | npm install -g pkg 10 | 11 | echo "Compiling node-file-manager" 12 | pkg -t node14-linux-x64 . 13 | -------------------------------------------------------------------------------- /herd-view/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'herd-view'; 10 | } 11 | -------------------------------------------------------------------------------- /herd-view/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /herd-view/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es2018", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-panel/login-panel.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-login-panel', 5 | templateUrl: './login-panel.component.html', 6 | styleUrls: ['./login-panel.component.css'] 7 | }) 8 | export class LoginPanelComponent {} 9 | -------------------------------------------------------------------------------- /ovpn-server/init/upstart.init: -------------------------------------------------------------------------------- 1 | # Copy to /etc/init/docker-openvpn.conf 2 | description "Docker container for OpenVPN server" 3 | start on filesystem and started docker 4 | stop on runlevel [!2345] 5 | respawn 6 | script 7 | exec docker run -v ovpn-data-example:/etc/openvpn --rm -p 1194:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn 8 | end script 9 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/ca-downloader/ca-downloader.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_sync_ftp_files.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_sync_ftp_files", 3 | "title": "Sync FTP", 4 | "description": "Sync FTP files", 5 | "binary": "lftp", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_service", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_sync_ftp_files.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_sync_ftp_files", 3 | "title": "Sync FTP", 4 | "description": "Sync FTP files", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_service", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_sync_asset_files.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_sync_asset_files", 3 | "title": "Sync Asset", 4 | "description": "Sync Asset files", 5 | "binary": "lftp", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_service", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_ipconfig.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_ipconfig", 3 | "title": "Interfaces", 4 | "description": "List all network interfaces", 5 | "binary": "ipconfig", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_sync_asset_files.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_sync_asset_files", 3 | "title": "Sync Asset", 4 | "description": "Sync Asset files", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_service", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-view/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-panel/login-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-input-element { 2 | padding-left: 10px; 3 | padding-right: 10px; 4 | } 5 | 6 | .mat-list-item { 7 | margin-top: 10px; 8 | margin-bottom: 10px; 9 | } 10 | 11 | .login-box { 12 | width: 280px; 13 | margin: 5% auto; 14 | } 15 | 16 | .spacer { 17 | flex: 1 1 auto; 18 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_interfaces.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_interfaces", 3 | "title": "Interfaces", 4 | "description": "List all network interfaces", 5 | "binary": "nmcli", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } 12 | -------------------------------------------------------------------------------- /herd-view/Dockerfile: -------------------------------------------------------------------------------- 1 | # Builder stage 2 | FROM node:current-alpine3.11 As builder 3 | 4 | WORKDIR /usr/src/app 5 | 6 | COPY package.json package-lock.json ./ 7 | 8 | RUN npm install 9 | 10 | COPY . . 11 | 12 | RUN npm run build --prod 13 | 14 | 15 | # Production stage 16 | FROM nginx:latest 17 | 18 | COPY --from=builder /usr/src/app/dist/herd-view/ /var/www/html 19 | -------------------------------------------------------------------------------- /herd-view/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-user_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-user_gateway'); 5 | 6 | class UserMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | } 13 | 14 | module.exports = UserMapper; 15 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/asset.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | import { Type } from './type'; 3 | 4 | export interface Asset extends RedHerdObject { 5 | name: string; 6 | ip: string; 7 | description: string; 8 | user: string; 9 | fingerprint: string; 10 | wport: number; 11 | joined: number; 12 | type: Type; 13 | } -------------------------------------------------------------------------------- /herd-view/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_ping", 3 | "title": "Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_ping", 3 | "title": "Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /etc/initialize-db/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "initialize-db", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "initialize-db.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "fs": "0.0.1-security", 13 | "sqlite-sync": "^0.3.9" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/centos_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "centos_ping", 3 | "title": "Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "centos_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } 12 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_wifi_interfaces.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_wifi_interfaces", 3 | "title": "WiFi Interfaces", 4 | "description": "List all Wi-Fi network interfaces", 5 | "binary": "airmon-ng", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [], 10 | "tags": ["automatic"] 11 | } 12 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/android_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "android_ping", 3 | "title": "Android Ping", 4 | "description": "Android ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "android_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-view/conf/herdview.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 443 ssl; 3 | server_name localhost; 4 | 5 | ssl_certificate /etc/nginx/cert.pem; 6 | ssl_certificate_key /etc/nginx/key.pem; 7 | 8 | location / { 9 | root /var/www/html; 10 | try_files $uri $uri/ /index.html; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_persistent_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_persistent_ping", 3 | "title": "Persistent Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_traceroute.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_traceroute", 3 | "title": "Traceroute", 4 | "description": "A traceroute demo module", 5 | "binary": "traceroute", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_traceroute.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_traceroute", 3 | "title": "Traceroute", 4 | "description": "A traceroute demo module", 5 | "binary": "tracert", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_persistent_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_persistent_ping", 3 | "title": "Persistent Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | 8 | env: 9 | PUBLIC_IP: "127.0.0.1" 10 | ASSETS_NUMBER: 1 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Build 20 | run: echo y | sudo ./deploy.sh -s ${{env.PUBLIC_IP}} -db -ca -k -u -a ${{env.ASSETS_NUMBER}} 21 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/centos_persistent_ping.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "centos_persistent_ping", 3 | "title": "Persistent Ping", 4 | "description": "A ping demo module", 5 | "binary": "ping", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "centos_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } 12 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_gophish.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_gophish", 3 | "title": "Gophish", 4 | "description": "Gophish phishing suite", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_delivery", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_push_file_to_ftp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_push_file_to_ftp", 3 | "title": "Push a file", 4 | "description": "Push a file to the FTP server", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_service", 8 | "version": "1.0", 9 | "params": [{"label": "File to push", "name": "file", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_guacamole.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_guacamole", 3 | "title": "Guacamole", 4 | "description": "Guacamole Remote Desktop", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_push_file_to_ftp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_push_file_to_ftp", 3 | "title": "Push a file", 4 | "description": "Push a file to the FTP server", 5 | "binary": "lftp", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_service", 8 | "version": "1.0", 9 | "params": [{"label": "File to push", "name": "file", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_pull_file_from_ftp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_pull_file_from_ftp", 3 | "title": "Pull a file", 4 | "description": "Pull a file from the FTP server", 5 | "binary": "lftp", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_service", 8 | "version": "1.0", 9 | "params": [{"label": "File to pull", "name": "file", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_gophish.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_gophish", 3 | "title": "Gophish", 4 | "description": "Gophish phishing suite", 5 | "binary": "gophish", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_delivery", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_pull_file_from_ftp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_pull_file_from_ftp", 3 | "title": "Pull a file", 4 | "description": "Pull a file from the FTP server", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_service", 8 | "version": "1.0", 9 | "params": [{"label": "File to pull", "name": "file", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-view/src/app/bin/auth/auth.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthGuard } from './auth.guard'; 4 | 5 | describe('AuthGuard', () => { 6 | let guard: AuthGuard; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | guard = TestBed.inject(AuthGuard); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(guard).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /etc/node-file-manager/lib/fileMap.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | var DATA_ROOT = C.data.root; 4 | 5 | exports.filePath = function (relPath, decodeURI) { 6 | if (decodeURI) relPath = decodeURIComponent(relPath); 7 | if (relPath.indexOf('..') >= 0){ 8 | var e = new Error('Do Not Contain .. in relPath!'); 9 | e.status = 400; 10 | throw e; 11 | } 12 | else { 13 | return path.join(DATA_ROOT, relPath); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_covenant.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_covenant", 3 | "title": "Covenant Framework", 4 | "description": "Covenant Framework", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_command_and_control", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_nmap_pingsweep.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_nmap_pingsweep", 3 | "title": "Nmap Ping Sweep", 4 | "description": "Nmap module to perform host discovery", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_rtsp_cam.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_rtsp_cam", 3 | "title": "RTSP Remote Cam Access", 4 | "description": "RTSP Remote Cam Access", 5 | "binary": "ffmpeg", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_actions", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_set.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_set", 3 | "title": "The Social-Engineer Toolkit", 4 | "description": "Social engineering attack suite", 5 | "binary": "set", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_delivery", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["interactive"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_nmap_pingsweep.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_nmap_pingsweep", 3 | "title": "Nmap Ping Sweep", 4 | "description": "Nmap module to perform host discovery", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_motion_cam.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_motion_cam", 3 | "title": "Motion Remote Cam Access", 4 | "description": "Motion Remote Cam Access", 5 | "binary": "motion", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_actions", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["pivotable"] 11 | } -------------------------------------------------------------------------------- /herd-view/src/app/bin/auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | 5 | describe('AuthService', () => { 6 | let service: AuthService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AuthService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/filemanager.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { RedHerdWebContext } from './base/redherd-web'; 3 | 4 | @Injectable({ 5 | providedIn: 'root' 6 | }) 7 | export class FilemanagerService { 8 | private context: RedHerdWebContext; 9 | 10 | constructor() { 11 | this.context = new RedHerdWebContext(); 12 | } 13 | 14 | public get Token() { 15 | return this.context.Token; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /herd-view/src/app/services/type.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TypeService } from './type.service'; 4 | 5 | describe('TypeService', () => { 6 | let service: TypeService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(TypeService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_metasploit.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_metasploit", 3 | "title": "Metasploit", 4 | "description": "Metasploit Framework", 5 | "binary": "msfconsole", 6 | "author": "peco602 & giulio", 7 | "topic": "debian_command_and_control", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["interactive"] 11 | } 12 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/ca-downloader/ca-downloader.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Config } from 'src/app/config'; 3 | 4 | @Component({ 5 | selector: 'app-ca-downloader', 6 | templateUrl: './ca-downloader.component.html', 7 | styleUrls: ['./ca-downloader.component.css'] 8 | }) 9 | export class CaDownloaderComponent { 10 | 11 | download(): void { 12 | window.open(Config.ca_url, "_blank"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /herd-view/src/app/services/asset.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AssetService } from './asset.service'; 4 | 5 | describe('AssetService', () => { 6 | let service: AssetService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AssetService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/topic.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TopicService } from './topic.service'; 4 | 5 | describe('TopicService', () => { 6 | let service: TopicService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(TopicService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_theharvester.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_theharvester", 3 | "title": "theHarvester", 4 | "description": "Passive information gathering about a domain or a company", 5 | "binary": "theHarvester.py", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Domain", "name": "domain", "type": "string"}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-view/src/app/services/module.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ModuleService } from './module.service'; 4 | 5 | describe('ModuleService', () => { 6 | let service: ModuleService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(ModuleService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/system.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { SystemService } from './system.service'; 4 | 5 | describe('SystemService', () => { 6 | let service: SystemService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(SystemService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_airgeddon.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_airgeddon", 3 | "title": "Airgeddon WiFi Attack Suite", 4 | "description": "Airgeddon WiFi Attack Suite", 5 | "binary": "airgeddon", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_exploitation", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["interactive"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_metasploit.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_metasploit", 3 | "title": "Metasploit Framework", 4 | "description": "Metasploit Framework", 5 | "binary": "msfconsole", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_command_and_control", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["interactive"] 11 | } -------------------------------------------------------------------------------- /herd-view/src/app/services/process.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ProcessService } from './process.service'; 4 | 5 | describe('ProcessService', () => { 6 | let service: ProcessService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(ProcessService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_wifiphisher.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_wifiphisher", 3 | "title": "WifiPhisher WiFi Attack Suite", 4 | "description": "WifiPhisher Attack Suite", 5 | "binary": "wifiphisher", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_exploitation", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 10 | "tags": ["interactive"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_defender.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_defender", 3 | "title": "Windows Defender", 4 | "description": "Enable/Disable Windows Defender real-time protection", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [{"label": "operation", "name": "operation", "type": "list", "values": ["activate", "deactivate"]}], 10 | "tags": ["automatic"] 11 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_wpscan.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_wpscan", 3 | "title": "WPScan", 4 | "description": "Check WordPress vulnerabilities", 5 | "binary": "wpscan", 6 | "author": "peco602 & giulio", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "URL", "name": "url", "type": "string"}, 10 | {"label": "Port", "name": "port", "type": "string"}], 11 | "tags": ["automatic"] 12 | } 13 | -------------------------------------------------------------------------------- /herd-view/src/app/services/socket-io.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { SocketIoService } from './socket-io.service'; 4 | 5 | describe('SocketIoService', () => { 6 | let service: SocketIoService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(SocketIoService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/tcp-proxy.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TcpProxyService } from './tcp-proxy.service'; 4 | 5 | describe('TcpProxyService', () => { 6 | let service: TcpProxyService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(TcpProxyService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/terminal.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { TerminalService } from './terminal.service'; 4 | 5 | describe('TerminalService', () => { 6 | let service: TerminalService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(TerminalService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/udp-proxy.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { UdpProxyService } from './udp-proxy.service'; 4 | 5 | describe('UdpProxyService', () => { 6 | let service: UdpProxyService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(UdpProxyService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-view/src/app/services/web-proxy.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { WebProxyService } from './web-proxy.service'; 4 | 5 | describe('WebProxyService', () => { 6 | let service: WebProxyService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(WebProxyService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_nikto.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_nikto", 3 | "title": "Nikto", 4 | "description": "Discovery web server vulnerabilities", 5 | "binary": "nikto", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}, 10 | {"label": "Port", "name": "port", "type": "number"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-user_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class UserGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "users"); 10 | } 11 | 12 | // Specialized query decorator 13 | findAll() 14 | { 15 | return this.select("SELECT id, uname, secret, enabled FROM users"); 16 | } 17 | } 18 | 19 | module.exports = UserGateway; -------------------------------------------------------------------------------- /herd-view/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # You can see what browsers were selected by your queries by running: 6 | # npx browserslist 7 | 8 | > 0.5% 9 | last 2 versions 10 | Firefox ESR 11 | not dead 12 | not IE 9-11 # For IE 9-11 support, remove 'not'. -------------------------------------------------------------------------------- /herd-view/src/app/services/filemanager.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FilemanagerService } from './filemanager.service'; 4 | 5 | describe('FilemanagerService', () => { 6 | let service: FilemanagerService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(FilemanagerService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-process_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-process_gateway'); 5 | 6 | class processMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | deleteBySession(session) 14 | { 15 | return this.gateway.deleteBySession(session); 16 | } 17 | } 18 | 19 | module.exports = processMapper; 20 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_nmap_tcp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_nmap_tcp", 3 | "title": "Nmap TCP Scan", 4 | "description": "Nmap module to scan TCP ports", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}, 10 | {"label": "Port range", "name": "ports", "type": "string"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_nmap_udp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_nmap_udp", 3 | "title": "Nmap UDP Scan", 4 | "description": "Nmap module to scan UDP ports", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}, 10 | {"label": "Port range", "name": "ports", "type": "string"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_download_file.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_download_file", 3 | "title": "Download File", 4 | "description": "Downloads a file into the shared folder", 5 | "binary": "wget", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_misc", 8 | "version": "1.0", 9 | "params": [{"label": "URL", "name": "url", "type": "string"}, 10 | {"label": "Filename", "name": "filename", "type": "string"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_nmap_tcp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_nmap_tcp", 3 | "title": "Nmap TCP Scan", 4 | "description": "Nmap module to scan TCP ports", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}, 10 | {"label": "Port range", "name": "ports", "type": "string"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_nmap_udp.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_nmap_udp", 3 | "title": "Nmap UDP Scan", 4 | "description": "Nmap module to scan UDP ports", 5 | "binary": "nmap", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Target range", "name": "target", "type": "string"}, 10 | {"label": "Port range", "name": "ports", "type": "string"}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-type_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-type_gateway'); 5 | 6 | class TypeMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | // Specialized query decorator 14 | findByName(name) 15 | { 16 | return this.gateway.findByName(name); 17 | } 18 | } 19 | 20 | module.exports = TypeMapper; 21 | -------------------------------------------------------------------------------- /herd-view/src/app/services/rtsp-redirector.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { RtspRedirectorService } from './rtsp-redirector.service'; 4 | 5 | describe('RtspRedirectorService', () => { 6 | let service: RtspRedirectorService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(RtspRedirectorService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-tcp_proxy_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ProxyController = require('./base/rdhd-ctr-base_proxy_controller'); 4 | const TcpProxyFactory = require('../bin/lib/rdhd-lib-tcp_proxy_factory'); 5 | const ProxyJobModulePath = __dirname + '/../bin/job/rdhd-job-tcp_proxy.js'; 6 | 7 | class TcpProxyController extends ProxyController 8 | { 9 | constructor() 10 | { 11 | super(TcpProxyFactory, ProxyJobModulePath); 12 | } 13 | } 14 | 15 | module.exports = TcpProxyController; -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-udp_proxy_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ProxyController = require('./base/rdhd-ctr-base_proxy_controller'); 4 | const UdpProxyFactory = require('../bin/lib/rdhd-lib-udp_proxy_factory'); 5 | const ProxyJobModulePath = __dirname + '/../bin/job/rdhd-job-udp_proxy.js'; 6 | 7 | class UdpProxyController extends ProxyController 8 | { 9 | constructor() 10 | { 11 | super(UdpProxyFactory, ProxyJobModulePath); 12 | } 13 | } 14 | 15 | module.exports = UdpProxyController; -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-web_proxy_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ProxyController = require('./base/rdhd-ctr-base_proxy_controller'); 4 | const WebProxyFactory = require('../bin/lib/rdhd-lib-web_proxy_factory'); 5 | const ProxyJobModulePath = __dirname + '/../bin/job/rdhd-job-web_proxy.js'; 6 | 7 | class WebProxyController extends ProxyController 8 | { 9 | constructor() 10 | { 11 | super(WebProxyFactory, ProxyJobModulePath); 12 | } 13 | } 14 | 15 | module.exports = WebProxyController; -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-topic_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-topic_gateway'); 5 | 6 | class TopicMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | // Specialized query decorator 14 | findByName(name) 15 | { 16 | return this.gateway.findByName(name); 17 | } 18 | } 19 | 20 | module.exports = TopicMapper; 21 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_ap_scan.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_ap_scan", 3 | "title": "AP Scan", 4 | "description": "List all available Access Points", 5 | "binary": "airodump-ng", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Interface", "name": "interface", "type": "string"}, 10 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-processes_monitor_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const ProcessMonitor = require('../bin/job/rdhd-job-process_monitor'); 4 | 5 | class ProcessesMonitorController 6 | { 7 | static start(msgServer) 8 | { 9 | let result = true; 10 | try 11 | { 12 | ProcessMonitor.run(msgServer); 13 | } 14 | catch (e) 15 | { 16 | result = false; 17 | } 18 | return result; 19 | } 20 | } 21 | 22 | module.exports = ProcessesMonitorController; -------------------------------------------------------------------------------- /herd-server/proto/rdhd-prt-fsmfp_messages.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class FSMFPMessages 4 | { 5 | // RedHerd Flexible Message Formatting Protocol getters: 6 | // ****************************** 7 | static get genericLv1Message() { return { "id": "", "type": "", "timestamp": "", "content": "" }; } 8 | // ****************************** 9 | static get genericLv2Message() { return { "src": "", "dst": "", "type": "", "session": "", "payload": "" }; } 10 | // ****************************** 11 | } 12 | 13 | module.exports = FSMFPMessages -------------------------------------------------------------------------------- /herd-view/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | RedHerd 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ovpn-server/otp/openvpn: -------------------------------------------------------------------------------- 1 | # Uses google authenticator library as PAM module using a single folder for all users tokens 2 | # User root is required to stick with an hardcoded user when trying to determine user id and allow unexisting system users 3 | # See https://github.com/google/google-authenticator-libpam#usersome-user 4 | auth required pam_google_authenticator.so secret=/etc/openvpn/otp/${USER}.google_authenticator user=root 5 | 6 | # Accept any user since we're dealing with virtual users there's no need to have a system account (pam_unix.so) 7 | account sufficient pam_permit.so 8 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_monitor_mode.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_monitor_mode", 3 | "title": "Monitor Mode", 4 | "description": "Enable/disable monitor mode for a specific wireless interface", 5 | "binary": "airmon-ng", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Interface", "name": "interface", "type": "string"}, 10 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 11 | "tags": ["automatic"] 12 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-wrapper/module-wrapper.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 |
11 |
12 |
13 |
-------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_dirb.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_dirb", 3 | "title": "Dirb", 4 | "description": "Enumerate web server directories", 5 | "binary": "dirb", 6 | "author": "peco602 & giulio", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Url", "name": "url", "type": "string"}, 10 | {"label": "Port", "name": "port", "type": "string"}, 11 | {"label": "Wordlist", "name": "wordlist", "type": "list", "values": ["small", "common", "big"]}], 12 | "tags": ["automatic"] 13 | } 14 | -------------------------------------------------------------------------------- /herd-view/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "es2020", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "lib": [ 15 | "es2018", 16 | "dom" 17 | ] 18 | }, 19 | "angularCompilerOptions": { 20 | "fullTemplateTypeCheck": true, 21 | "strictInjectionParameters": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/macos_transfer.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "macos_transfer", 3 | "title": "Transfer", 4 | "description": "Transfer asset to another RedHerd infrastructure", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "macos_service", 8 | "version": "1.0", 9 | "params": [ 10 | {"label": "Public IP", "name": "public_ip", "type": "string"}, 11 | {"label": "Username", "name": "username", "type": "string"}, 12 | {"label": "Password", "name": "password", "type": "string"} 13 | ], 14 | "tags": ["automatic"] 15 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/android_transfer.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "android_transfer", 3 | "title": "Transfer", 4 | "description": "Transfer asset to another RedHerd infrastructure", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "android_service", 8 | "version": "1.0", 9 | "params": [ 10 | {"label": "Public IP", "name": "public_ip", "type": "string"}, 11 | {"label": "Username", "name": "username", "type": "string"}, 12 | {"label": "Password", "name": "password", "type": "string"} 13 | ], 14 | "tags": ["automatic"] 15 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_transfer.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_transfer", 3 | "title": "Transfer", 4 | "description": "Transfer asset to another RedHerd infrastructure", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_service", 8 | "version": "1.0", 9 | "params": [ 10 | {"label": "Public IP", "name": "public_ip", "type": "string"}, 11 | {"label": "Username", "name": "username", "type": "string"}, 12 | {"label": "Password", "name": "password", "type": "string"} 13 | ], 14 | "tags": ["automatic"] 15 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_transfer.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_transfer", 3 | "title": "Transfer", 4 | "description": "Transfer asset to another RedHerd infrastructure", 5 | "binary": "", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_service", 8 | "version": "1.0", 9 | "params": [ 10 | {"label": "Public IP", "name": "public_ip", "type": "string"}, 11 | {"label": "Username", "name": "username", "type": "string"}, 12 | {"label": "Password", "name": "password", "type": "string"} 13 | ], 14 | "tags": ["automatic"] 15 | } -------------------------------------------------------------------------------- /herd-view/src/app/services/socket-io.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Socket } from 'ngx-socket-io'; 3 | import { Observable } from 'rxjs'; 4 | import { Lv2Message } from '../bin/proto/lv2-message'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class SocketioService { 10 | constructor(private socket: Socket) { } 11 | 12 | public getMessages(): Observable { 13 | return new Observable((observer) => { 14 | this.socket.on('message', (message) => { 15 | observer.next(message); 16 | }); 17 | }); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_hping3_synflood.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_hping3_synflood", 3 | "title": "Hping3 SYN Flood", 4 | "description": "Perform a SYN Flood attack against a target", 5 | "binary": "hping3", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_exploitation", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}, 10 | {"label": "Port", "name": "port", "type": "number"}, 11 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 12 | "tags": ["automatic"] 13 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_nc_listener.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_nc_listener", 3 | "title": "Netcat Listener", 4 | "description": "Spawns a Netcat listener on a port", 5 | "binary": "nc", 6 | "author": "peco602 & giulio", 7 | "topic": "debian_misc", 8 | "version": "1.0", 9 | "params": [{"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}, 10 | {"label": "Port", "name": "port", "type": "string"}, 11 | {"label": "Protocol", "name": "protocol", "type": "list", "values": ["tcp", "udp"]}], 12 | "tags": ["interactive"] 13 | } 14 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_tcpdump_interface.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_tcpdump_interface", 3 | "title": "Tcpdump Interface", 4 | "description": "Sniff traffic on a given interface", 5 | "binary": "tcpdump", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_reconnaissance", 8 | "version": "1.0", 9 | "params": [{"label": "Interface", "name": "interface", "type": "string"}, 10 | {"label": "Dump to file", "name": "dump", "type": "boolean"}, 11 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 12 | "tags": ["automatic"] 13 | } -------------------------------------------------------------------------------- /herd-server/bin/lib/base/rdhd-lib-service_finalizer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const killPort = require('kill-port'); 4 | 5 | class ServiceFinalizer 6 | { 7 | static destroy(port, transport = 'tcp') 8 | { 9 | let result = true; 10 | try 11 | { 12 | setTimeout(() => { 13 | killPort(port, transport) 14 | .then(console.log) 15 | .catch(console.log) 16 | }, 500); 17 | } 18 | catch (e) 19 | { 20 | result = false; 21 | } 22 | return result; 23 | } 24 | } 25 | 26 | module.exports = ServiceFinalizer; -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_john_wordlist.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_john_wordlist", 3 | "title": "JohnTheRipper Wordlist", 4 | "description": "Crack a file using JohnTheRipper in Wordlist mode", 5 | "binary": "john", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "debian_exploitation", 8 | "version": "1.0", 9 | "params": [{"label": "Wordlist", "name": "wordlist", "type": "string"}, 10 | {"label": "File to be cracked", "name": "passfile", "type": "string"}, 11 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 12 | "tags": ["automatic"] 13 | } -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-system_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-system_gateway'); 5 | 6 | class SystemMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | // Specialized query decorator 14 | findBySeed(seed) 15 | { 16 | return this.gateway.findBySeed(seed); 17 | } 18 | 19 | // Specialized query decorator 20 | findCurrent() 21 | { 22 | return this.gateway.findCurrent(); 23 | } 24 | } 25 | 26 | module.exports = SystemMapper; 27 | -------------------------------------------------------------------------------- /utils/install_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! "$UID" -eq "0" ]; then 4 | echo "Run as root user" 5 | exit 1 6 | fi 7 | 8 | apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common 9 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 10 | apt-key fingerprint 0EBFCD88 11 | add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 12 | add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" 13 | 14 | apt update 15 | apt -y install docker-ce docker-ce-cli containerd.io 16 | docker run hello-world 17 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/service.ts: -------------------------------------------------------------------------------- 1 | export enum ServiceType { 2 | http_proxy = 'HTTP_PROXY', 3 | tcp_proxy = 'TCP_PROXY', 4 | udp_proxy = 'UDP_PROXY', 5 | rtsp_redirector = 'RTSP_REDIRECTOR', 6 | terminal = 'TERMINAL' 7 | } 8 | 9 | export enum ServiceOperation { 10 | enable = 'ENABLE', 11 | disable = 'DISABLE' 12 | } 13 | 14 | export interface ServiceRequest { 15 | type: ServiceType; 16 | params?: T; 17 | } 18 | 19 | export interface ServiceRequestEnvelope { 20 | operation: ServiceOperation; 21 | service: ServiceRequest; 22 | } 23 | 24 | export interface ServiceResponse { 25 | enabled: boolean; 26 | ports?: {}; 27 | } -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-asset_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-asset_gateway'); 5 | 6 | class AssetMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | // Specialized query decorator 14 | findByName(name) 15 | { 16 | return this.gateway.findByName(name); 17 | } 18 | 19 | // Specialized query decorator 20 | findByFingerprint(fingerprint) 21 | { 22 | return this.gateway.findByFingerprint(fingerprint); 23 | } 24 | } 25 | 26 | module.exports = AssetMapper; 27 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-module_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Gateway = require('./rdhd-mdl-module_gateway'); 4 | 5 | class ModuleMapper 6 | { 7 | constructor(repo) 8 | { 9 | this.gateway = new Gateway(repo); 10 | } 11 | 12 | // Specialized decorator 13 | findByName(name) 14 | { 15 | return this.gateway.findByName(name); 16 | } 17 | 18 | // Specialized decorator 19 | findByTopic(topic) 20 | { 21 | return this.gateway.findByTopic(topic); 22 | } 23 | 24 | // Specialized decorator 25 | findAll() 26 | { 27 | return this.gateway.findAll(); 28 | } 29 | } 30 | 31 | module.exports = ModuleMapper; 32 | -------------------------------------------------------------------------------- /herd-server/bin/lib/rdhd-lib-file_manager_factory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const { spawn } = require("child_process"); 4 | 5 | class FileManagerFactory 6 | { 7 | static spawn(bindAddress, bindPort, mountDir = '/') 8 | { 9 | try 10 | { 11 | let fileManagerConf = [ "-s", bindAddress, 12 | "-p", bindPort, 13 | "-d", mountDir ]; 14 | 15 | spawn("node-file-manager", fileManagerConf); 16 | 17 | return bindPort; 18 | } 19 | catch (e) 20 | { 21 | return false; 22 | } 23 | } 24 | } 25 | 26 | module.exports = FileManagerFactory; -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-process-panel/asset-process-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .full-width-table { 29 | width: 100%; 30 | text-align: left; 31 | } 32 | 33 | .spacer { 34 | flex: 1 1 auto; 35 | } 36 | 37 | .details { 38 | color: inherit; 39 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-process-panel/module-process-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .full-width-table { 29 | width: 100%; 30 | text-align: left; 31 | } 32 | 33 | .spacer { 34 | flex: 1 1 auto; 35 | } 36 | 37 | .details { 38 | color: inherit; 39 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-module-panel/asset-module-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .full-width-table { 29 | width: 100%; 30 | text-align: left; 31 | } 32 | 33 | .spacer { 34 | flex: 1 1 auto; 35 | } 36 | 37 | .execute, 38 | .details { 39 | color: inherit; 40 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-topic-panel/asset-topic-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .full-width-table { 29 | width: 100%; 30 | text-align: left; 31 | } 32 | 33 | .spacer { 34 | flex: 1 1 auto; 35 | } 36 | 37 | .execute, 38 | .details { 39 | color: inherit; 40 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-asset-panel/module-asset-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .full-width-table { 29 | width: 100%; 30 | text-align: left; 31 | } 32 | 33 | .spacer { 34 | flex: 1 1 auto; 35 | } 36 | 37 | .execute, 38 | .details { 39 | color: inherit; 40 | } -------------------------------------------------------------------------------- /herd-view/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | 6 | .mat-elevation-z8 { 7 | /*width: 98%;*/ 8 | /*margin: 10px auto;*/ 9 | width: 100%; 10 | margin: 0; 11 | background-color: rgb(66, 66, 66); 12 | } 13 | 14 | .mat-divider-red { 15 | border-top-color: rgb(244, 67, 54); 16 | } 17 | 18 | .mat-divider-blue { 19 | border-top-color: rgb(0, 122, 204); 20 | } 21 | 22 | .online { 23 | color: rgb(139, 195, 74); 24 | } 25 | 26 | .offline { 27 | color: rgb(244, 67, 54); 28 | } 29 | 30 | .unknown { 31 | color: orange; 32 | } -------------------------------------------------------------------------------- /ovpn-server/bin/ovpn_getclient_all: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## @licence MIT 3 | ## @author Copyright (C) 2015 Robin Schneider 4 | 5 | if [ -z "$OPENVPN" ]; then 6 | export OPENVPN="$PWD" 7 | fi 8 | if ! source "$OPENVPN/ovpn_env.sh"; then 9 | echo "Could not source $OPENVPN/ovpn_env.sh." 10 | exit 1 11 | fi 12 | if [ -z "$EASYRSA_PKI" ]; then 13 | export EASYRSA_PKI="$OPENVPN/pki" 14 | fi 15 | 16 | pushd "$EASYRSA_PKI" 17 | for name in issued/*.crt; do 18 | name=${name%.crt} 19 | name=${name#issued/} 20 | if [ "$name" != "$OVPN_CN" ]; then 21 | ovpn_getclient "$name" separated 22 | ovpn_getclient "$name" combined-save 23 | fi 24 | done 25 | popd 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/processes-table/processes-table.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-list-base { 14 | padding-top: 0; 15 | padding-right: 5px; 16 | } 17 | 18 | .mat-input-element { 19 | padding-left: 10px; 20 | padding-right: 10px; 21 | } 22 | 23 | .mat-form-field { 24 | display: block; 25 | padding-left: 10px; 26 | padding-right: 10px; 27 | } 28 | 29 | .mat-icon { 30 | margin: 0 10px; 31 | } 32 | 33 | .full-width-table { 34 | width: 100%; 35 | } 36 | 37 | .spacer { 38 | flex: 1 1 auto; 39 | } 40 | 41 | .details { 42 | color: inherit; 43 | } -------------------------------------------------------------------------------- /herd-view/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /herd-view/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('herd-view app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /herd-server/bin/lib/rdhd-lib-tcp_proxy_factory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Ref: https://www.npmjs.com/package/node-tcp-proxy 4 | const proxy = require('node-tcp-proxy'); 5 | const ServiceFinalizer = require('./base/rdhd-lib-service_finalizer'); 6 | 7 | class TcpProxyFactory 8 | { 9 | static spawn(port, targetHosts, targetPorts) 10 | { 11 | let result = true; 12 | try 13 | { 14 | let tcpProxy = proxy.createProxy(port, targetHosts, targetPorts); 15 | } 16 | catch (e) 17 | { 18 | result = false; 19 | } 20 | return result; 21 | } 22 | 23 | static destroy(port) 24 | { 25 | return ServiceFinalizer.destroy(port); 26 | } 27 | } 28 | 29 | module.exports = TcpProxyFactory; -------------------------------------------------------------------------------- /herd-view/src/app/controls/terminal/terminal.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | -------------------------------------------------------------------------------- /ovpn-server/bin/easyrsa_vars: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Import/export EasyRSA default settings 5 | # 6 | 7 | if [ "$DEBUG" == "1" ]; then 8 | set -x 9 | fi 10 | 11 | set -e 12 | 13 | if [ $# -lt 1 ]; then 14 | echo "No command provided" 15 | echo 16 | echo "$0 export > /path/to/file" 17 | echo "$0 import < /path/to/file" 18 | exit 1 19 | fi 20 | 21 | cmd=$1 22 | shift 23 | 24 | case "$cmd" in 25 | export) 26 | if [ -f "$EASYRSA_VARS_FILE" ]; then 27 | cat "$EASYRSA_VARS_FILE" 28 | else 29 | cat "$EASYRSA/vars.example" 30 | fi 31 | ;; 32 | import) 33 | cat > "$EASYRSA_VARS_FILE" 34 | ;; 35 | *) 36 | echo "Unknown cmd \"$cmd\"" 37 | exit 2 38 | ;; 39 | esac 40 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/filemanager/filemanager.component.css: -------------------------------------------------------------------------------- 1 | .mat-card { 2 | box-shadow: none; 3 | border-radius: 0; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | } 8 | 9 | .mat-list-base { 10 | padding-top: 0; 11 | padding-right: 5px; 12 | } 13 | 14 | .mat-icon { 15 | margin: 0 10px; 16 | } 17 | 18 | .bar-button { 19 | display: block; 20 | color: inherit; 21 | } 22 | 23 | .spacer { 24 | flex: 1 1 auto; 25 | } 26 | 27 | .filemanager-wrapper { 28 | background-color: rgb(66, 66, 66); 29 | display: block; 30 | padding-left: 5px; 31 | padding-right: 5px; 32 | } 33 | 34 | .filemanager-container { 35 | background-color: rgb(66, 66, 66); 36 | width: 100%; 37 | height: 75vh; 38 | border: none; 39 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-tab/module-tab.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ModuleTabComponent } from './module-tab.component'; 4 | 5 | describe('ModuleTabComponent', () => { 6 | let component: ModuleTabComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ModuleTabComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModuleTabComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-tab/module-tab.component.css: -------------------------------------------------------------------------------- 1 | .mat-expansion-panel { 2 | box-shadow: none; 3 | border-radius: 0; 4 | width: 100%; 5 | margin: auto; 6 | text-align: center; 7 | } 8 | 9 | .mat-select, 10 | .mat-input-element { 11 | padding-left: 10px; 12 | padding-right: 10px; 13 | } 14 | 15 | .mat-list-item { 16 | margin-top: 10px; 17 | margin-bottom: 10px; 18 | } 19 | 20 | .mat-raised-button { 21 | margin-left: 10px; 22 | margin-right: 10px; 23 | } 24 | 25 | .mat-form-field { 26 | display: block; 27 | padding-left: 10px; 28 | padding-right: 10px; 29 | width: 100%; 30 | } 31 | 32 | .mat-icon { 33 | margin: 0 10px; 34 | } 35 | 36 | .spacer { 37 | flex: 1 1 auto; 38 | } 39 | 40 | .capitalize { 41 | text-transform: capitalize; 42 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/modules-table/modules-table.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-list-base { 14 | padding-top: 0; 15 | padding-right: 5px; 16 | } 17 | .mat-input-element { 18 | padding-left: 10px; 19 | padding-right: 10px; 20 | } 21 | 22 | .mat-form-field { 23 | display: block; 24 | padding-left: 10px; 25 | padding-right: 10px; 26 | } 27 | 28 | .mat-icon { 29 | margin: 0 10px; 30 | } 31 | 32 | .full-width-table { 33 | width: 100%; 34 | } 35 | 36 | .row-icon { 37 | width: 32px; 38 | height: 32px; 39 | } 40 | 41 | .spacer { 42 | flex: 1 1 auto; 43 | } 44 | 45 | .details { 46 | color: inherit; 47 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/terminal/terminal.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { TerminalComponent } from './terminal.component'; 4 | 5 | describe('TerminalComponent', () => { 6 | let component: TerminalComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ TerminalComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(TerminalComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-panel/module-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-expansion-panel { 2 | box-shadow: none; 3 | border-radius: 0; 4 | width: 100%; 5 | margin: auto; 6 | text-align: center; 7 | } 8 | 9 | .mat-select, 10 | .mat-input-element { 11 | padding-left: 10px; 12 | padding-right: 10px; 13 | } 14 | 15 | .mat-list-item { 16 | margin-top: 10px; 17 | margin-bottom: 10px; 18 | } 19 | 20 | .mat-raised-button { 21 | margin-left: 10px; 22 | margin-right: 10px; 23 | } 24 | 25 | .mat-form-field { 26 | display: block; 27 | padding-left: 10px; 28 | padding-right: 10px; 29 | width: 100%; 30 | } 31 | 32 | .mat-icon { 33 | margin: 0 10px; 34 | } 35 | 36 | .spacer { 37 | flex: 1 1 auto; 38 | } 39 | 40 | .capitalize { 41 | text-transform: capitalize; 42 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/assets-board/assets-board.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AssetsBoardComponent } from './assets-board.component'; 4 | 5 | describe('AssetBoardComponent', () => { 6 | let component: AssetsBoardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AssetsBoardComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AssetsBoardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-form/login-form.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { LoginFormComponent } from './login-form.component'; 4 | 5 | describe('LoginFormComponent', () => { 6 | let component: LoginFormComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginFormComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginFormComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-system_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class SystemGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "types"); 10 | } 11 | 12 | // Specialized query decorator 13 | findBySeed(seed) 14 | { 15 | return this.select("SELECT seed, dob FROM system WHERE seed = ?", [ seed ])[0]; 16 | } 17 | 18 | // Specialized query decorator 19 | findCurrent() 20 | { 21 | return this.select("SELECT * FROM system ORDER BY dob DESC LIMIT 1")[0]; 22 | } 23 | 24 | // Specialized query decorator 25 | findAll() 26 | { 27 | return this.select("SELECT seed, dob FROM system"); 28 | } 29 | } 30 | 31 | module.exports = SystemGateway; -------------------------------------------------------------------------------- /herd-view/src/app/services/base/redherd-web.ts: -------------------------------------------------------------------------------- 1 | import { HttpHeaders } from '@angular/common/http'; 2 | import { Config } from 'src/app/config'; 3 | import { JwtToken } from '../../bin/model/token'; 4 | 5 | export class RedHerdWebContext { 6 | protected httpOptions: { headers: HttpHeaders }; 7 | protected token: JwtToken; 8 | 9 | constructor() { 10 | this.httpOptions = { 11 | headers: new HttpHeaders({ 12 | 'Content-Type': 'application/json' 13 | }) 14 | }; 15 | } 16 | 17 | public get Token(): JwtToken { 18 | return new JwtToken( 19 | Config.single_instance ? sessionStorage.getItem(Config.auth_token_store) : localStorage.getItem(Config.auth_token_store) 20 | ); 21 | } 22 | 23 | public get HttpOptions(): { headers: HttpHeaders } { 24 | return this.httpOptions; 25 | } 26 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-panel/asset-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { AssetPanelComponent } from './asset-panel.component'; 4 | 5 | describe('AssetPanelComponent', () => { 6 | let component: AssetPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AssetPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AssetPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-panel/login-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { LoginPanelComponent } from './login-panel.component'; 4 | 5 | describe('LoginPanelComponent', () => { 6 | let component: LoginPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/modules-board/modules-board.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ModulesBoardComponent } from './modules-board.component'; 4 | 5 | describe('ModulesBoardComponent', () => { 6 | let component: ModulesBoardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ModulesBoardComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModulesBoardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/filemanager/filemanager.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { FilemanagerComponent } from './filemanager.component'; 4 | 5 | describe('FilemanagerComponent', () => { 6 | let component: FilemanagerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ FilemanagerComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FilemanagerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-panel/module-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { ModulePanelComponent } from './module-panel.component'; 4 | 5 | describe('ModulePanelComponent', () => { 6 | let component: ModulePanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ModulePanelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModulePanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/ca-downloader/ca-downloader.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { CaDownloaderComponent } from './ca-downloader.component'; 4 | 5 | describe('CaDownloaderComponent', () => { 6 | let component: CaDownloaderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ CaDownloaderComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CaDownloaderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-type_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class TypeGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "types"); 10 | } 11 | 12 | // Specialized query decorator 13 | findById(id) 14 | { 15 | return this.select("SELECT id, name, description FROM types WHERE id = ?", [ id ])[0]; 16 | } 17 | 18 | // Specialized query decorator 19 | findByName(name) 20 | { 21 | return this.select("SELECT id, name, description FROM types WHERE name = ?", [ name ])[0]; 22 | } 23 | 24 | // Specialized query decorator 25 | findAll() 26 | { 27 | return this.select("SELECT id, name, description FROM types"); 28 | } 29 | } 30 | 31 | module.exports = TypeGateway; -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/base/redherd-common.ts: -------------------------------------------------------------------------------- 1 | export enum RedHerdRootEndpoint { 2 | assets = 'assets', 3 | modules = 'modules', 4 | processes = 'processes', 5 | topics = 'topics', 6 | types = 'types', 7 | login = 'login', 8 | system = 'system' 9 | } 10 | 11 | export enum RedHerdEntity { 12 | asset = 'asset', 13 | assets = 'assets', 14 | module = 'module', 15 | modules = 'modules', 16 | process = 'process', 17 | processes = 'processes', 18 | topic = 'topic', 19 | topics = 'topics', 20 | type = 'type', 21 | types = 'types', 22 | instance = 'instance', 23 | instances = 'instances', 24 | ports = 'ports', 25 | result = 'result', 26 | service = 'service', 27 | token = 'token', 28 | system = 'system' 29 | } 30 | 31 | export interface RedHerdObject { 32 | id?: number; 33 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-wrapper/module-wrapper.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { ModuleWrapperComponent } from './module-wrapper.component'; 4 | 5 | describe('ModuleWrapperComponent', () => { 6 | let component: ModuleWrapperComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ModuleWrapperComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModuleWrapperComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/auth/auth.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router'; 3 | import { Observable } from 'rxjs'; 4 | import { map, take } from 'rxjs/operators'; 5 | import { AuthService } from './auth.service'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class AuthGuard implements CanActivate { 11 | constructor( 12 | private authService: AuthService 13 | ) {} 14 | 15 | canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { 16 | return this.authService.isLoggedIn 17 | .pipe( 18 | take(1), 19 | map((isLoggedIn: boolean) => { 20 | if (!isLoggedIn) { 21 | return false; 22 | } 23 | return true; 24 | }) 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_hydra.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debian_hydra", 3 | "title": "Hydra", 4 | "description": "Brute force FTP/RDP/SSH credentials", 5 | "binary": "hydra", 6 | "author": "peco602 & giulio", 7 | "topic": "debian_exploitation", 8 | "version": "1.0", 9 | "params": [{"label": "Target", "name": "target", "type": "string"}, 10 | {"label": "Port", "name": "port", "type": "string"}, 11 | {"label": "Protocol", "name": "protocol", "type": "list", "values": ["ftp", "rdp", "ssh"]}, 12 | {"label": "Username List", "name": "userList", "type": "string"}, 13 | {"label": "Password List", "name": "passList", "type": "string"}, 14 | {"label": "Operation", "name": "operation", "type": "list", "values": ["start", "stop"]}], 15 | "tags": ["automatic"] 16 | } 17 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-topic_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class TopicGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "topics"); 10 | } 11 | 12 | // Specialized query decorator 13 | findById(id) 14 | { 15 | return this.select("SELECT id, name, description FROM topics WHERE id = ?", [ id ])[0]; 16 | } 17 | 18 | // Specialized query decorator 19 | findByName(name) 20 | { 21 | return this.select("SELECT id, name, description FROM topics WHERE name = ?", [ name ])[0]; 22 | } 23 | 24 | // Specialized query decorator 25 | findAll() 26 | { 27 | return this.select("SELECT id, name, description FROM topics"); 28 | } 29 | } 30 | 31 | module.exports = TopicGateway; -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-asset-panel/module-asset-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ModuleAssetPanelComponent } from './module-asset-panel.component'; 4 | 5 | describe('ModuleAssetPanelComponent', () => { 6 | let component: ModuleAssetPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ModuleAssetPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModuleAssetPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/gui/display.ts: -------------------------------------------------------------------------------- 1 | import { Component, HostListener } from '@angular/core'; 2 | 3 | export enum DisplayMode { 4 | mobile = 'mobile', 5 | desktop = 'desktop' 6 | } 7 | 8 | @Component({ 9 | template: '' 10 | }) 11 | export abstract class AdaptiveComponent { 12 | private maxWidth: number; 13 | private display: DisplayMode; 14 | 15 | constructor() { 16 | this.maxWidth = 960; 17 | this.display = this.getDisplayMode(); 18 | } 19 | 20 | get displayMode(): DisplayMode { 21 | return this.display; 22 | } 23 | 24 | @HostListener('window:resize', ['$event']) 25 | onResize(_) { 26 | this.display = this.getDisplayMode(); 27 | } 28 | 29 | protected getDisplayMode(): DisplayMode { 30 | return window.innerWidth >= this.maxWidth ? DisplayMode.desktop : DisplayMode.mobile; 31 | } 32 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-topic-panel/asset-topic-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { AssetTopicPanelComponent } from './asset-topic-panel.component'; 4 | 5 | describe('AssetTopicPanelComponent', () => { 6 | let component: AssetTopicPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AssetTopicPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AssetTopicPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-output-panel/module-output-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ModuleOutputPanelComponent } from './module-output-panel.component'; 4 | 5 | describe('ModuleOutputPanelComponent', () => { 6 | let component: ModuleOutputPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ModuleOutputPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModuleOutputPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-file_manager_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const FileManagerFactory = require('../bin/lib/rdhd-lib-file_manager_factory'); 4 | const WebProxyFactory = require('../bin/lib/rdhd-lib-web_proxy_factory'); 5 | 6 | class FileManagerController 7 | { 8 | constructor() { } 9 | 10 | spawn(bindAddress, serverPort = 30002, proxyPort = 3002, mountDir = '/', key = '', cert = '', ca = '', auth = false, ssl = false) 11 | { 12 | let result = true; 13 | 14 | try 15 | { 16 | FileManagerFactory.spawn(bindAddress, serverPort, mountDir); 17 | WebProxyFactory.spawn(proxyPort, '127.0.0.1', serverPort, key, cert, ca, auth, ssl); 18 | } 19 | catch (e) 20 | { 21 | result = false; 22 | } 23 | return result; 24 | } 25 | } 26 | 27 | module.exports = FileManagerController; -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-detail-panel/asset-detail-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { AssetDetailPanelComponent } from './asset-detail-panel.component'; 4 | 5 | describe('AssetDetailPanelComponent', () => { 6 | let component: AssetDetailPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AssetDetailPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AssetDetailPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-process-panel/module-process-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ModuleProcessPanelComponent } from './module-process-panel.component'; 4 | 5 | describe('ModuleProcessPanelComponent', () => { 6 | let component: ModuleProcessPanelComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ModuleProcessPanelComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ModuleProcessPanelComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/terminal/terminal.component.css: -------------------------------------------------------------------------------- 1 | .mat-card { 2 | box-shadow: none; 3 | border-radius: 0; 4 | display: flex; 5 | justify-content: center; 6 | align-items: center; 7 | } 8 | 9 | .mat-list-item { 10 | margin-top: 9px; 11 | margin-bottom: 6px; 12 | } 13 | 14 | .mat-icon { 15 | margin: 0 10px; 16 | } 17 | 18 | .bar-button { 19 | display: block; 20 | color: inherit; 21 | } 22 | 23 | .spacer { 24 | flex: 1 1 auto; 25 | } 26 | 27 | .spinner { 28 | margin-top: 150px; 29 | margin-bottom: 150px; 30 | } 31 | 32 | .terminal-wrapper { 33 | background-color: black; 34 | display: block; 35 | padding-top: 5px; 36 | padding-bottom: 5px; 37 | padding-left: 5px; 38 | padding-right: 5px; 39 | } 40 | 41 | .terminal-container { 42 | background-color: black; 43 | width: 100%; 44 | height: 400px; 45 | border: none; 46 | margin-top: 5px; 47 | margin-bottom: 5px; 48 | } -------------------------------------------------------------------------------- /herd-server/bin/lib/rdhd-lib-udp_proxy_factory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Ref: https://www.npmjs.com/package/udp-proxy 4 | const proxy = require('udp-proxy'); 5 | const ServiceFinalizer = require('./base/rdhd-lib-service_finalizer'); 6 | 7 | class UdpProxyFactory 8 | { 9 | static spawn(port, targetHost, targetPort) 10 | { 11 | let result = true; 12 | try 13 | { 14 | let options = { 15 | address: targetHost, 16 | port: targetPort, 17 | localport: port 18 | }; 19 | 20 | let udpProxy = proxy.createServer(options); 21 | } 22 | catch (e) 23 | { 24 | result = false; 25 | } 26 | return result; 27 | } 28 | 29 | static destroy(port) 30 | { 31 | return ServiceFinalizer.destroy(port, 'udp'); 32 | } 33 | } 34 | 35 | module.exports = UdpProxyFactory; -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-form/login-form.component.css: -------------------------------------------------------------------------------- 1 | .mat-card { 2 | max-width: 400px; 3 | margin: 2em auto; 4 | text-align: center; 5 | } 6 | 7 | .mat-card-header { 8 | display: block; 9 | } 10 | 11 | .mat-input-element { 12 | padding-left: 10px; 13 | padding-right: 10px; 14 | } 15 | 16 | .mat-raised-button { 17 | margin-top: 10px; 18 | margin-bottom: 10px; 19 | margin-left: 0; 20 | margin-right: 0; 21 | } 22 | 23 | .signin-content { 24 | margin: auto; 25 | text-align: center; 26 | font: 400 14px/20px Roboto, "Helvetica Neue", sans-serif; 27 | letter-spacing: normal; 28 | } 29 | 30 | .full-width-input { 31 | width: 100%; 32 | } 33 | 34 | .login-box { 35 | border-style: solid; 36 | border-width: 1px; 37 | border-radius: 3px; 38 | border-color: rgb(244, 67, 54); 39 | } 40 | 41 | .login-logo { 42 | width: 190px; 43 | margin: auto; 44 | } -------------------------------------------------------------------------------- /herd-server/controllers/rdhd-ctr-system_controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class SystemController 4 | { 5 | constructor(broker, system) 6 | { 7 | this._broker = broker; 8 | 9 | // { seed: "", dob: timestamp } 10 | this._system = system; 11 | } 12 | 13 | get seed() 14 | { 15 | return this._system.seed; 16 | } 17 | 18 | get dob() 19 | { 20 | return this._system.dob; 21 | } 22 | 23 | persist() 24 | { 25 | throw new Error("Not Implemented"); 26 | } 27 | 28 | remove() 29 | { 30 | throw new Error("Not Implemented"); 31 | } 32 | 33 | present() 34 | { 35 | let result = {}; 36 | 37 | if (this._system) 38 | { 39 | result = { seed: this._system.seed, dob: this._system.dob }; 40 | } 41 | return result; 42 | } 43 | } 44 | 45 | module.exports = SystemController; -------------------------------------------------------------------------------- /herd-server/bin/job/rdhd-job-rtsp_redirector.js: -------------------------------------------------------------------------------- 1 | const RtspRedirectorFactory = require('../lib/rdhd-lib-rtsp_redirector_factory'); 2 | const Validator = require('../lib/rdhd-lib-input_validator'); 3 | 4 | try 5 | { 6 | // ************************************************************ 7 | // Instance specific parameters 8 | // ************************************************************ 9 | let cPort = Validator.validateTcpUdpPort(process.argv[2]) ? process.argv[2] : false; 10 | let sPort = Validator.validateTcpUdpPort(process.argv[3]) ? process.argv[3] : false; 11 | 12 | if (sPort && cPort) 13 | { 14 | // ************************************************************ 15 | // Spawn new RTSP redirector 16 | // ************************************************************ 17 | RtspRedirectorFactory.spawn(sPort, cPort); 18 | } 19 | } 20 | catch (e) 21 | { 22 | console.log(e); 23 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/module-wrapper/module-wrapper.component.css: -------------------------------------------------------------------------------- 1 | .mat-icon { 2 | margin: 0 10px; 3 | } 4 | 5 | .mat-divider-red { 6 | border-top-color: rgb(244, 67, 54); 7 | } 8 | 9 | .mat-divider-blue { 10 | border-top-color: blue; 11 | } 12 | 13 | .progress-card { 14 | box-shadow: none; 15 | border-radius: 0; 16 | display: flex; 17 | justify-content: center; 18 | align-items: center; 19 | } 20 | 21 | .bar-button { 22 | display: block; 23 | color: inherit; 24 | } 25 | 26 | .spacer { 27 | flex: 1 1 auto; 28 | } 29 | 30 | .content-wrapper { 31 | display: block; 32 | padding-left: 5px; 33 | padding-right: 5px; 34 | } 35 | 36 | .terminal-wrapper { 37 | background-color: black; 38 | padding-top: 5px; 39 | padding-bottom: 5px; 40 | padding-left: 5px; 41 | } 42 | 43 | .content-container { 44 | width: 100%; 45 | height: 75vh; 46 | border: none; 47 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_ipconfig.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WindowsModule = require('../base/rdhd-mod-base_windows_module'); 4 | 5 | // moduleCode: windows_ipconfig 6 | class WindowsInterfaces extends WindowsModule 7 | { 8 | constructor(asset, context, session, wsServer, token) 9 | { 10 | super(asset, "windows_ipconfig", session, wsServer, token); 11 | } 12 | 13 | run(whatIf = false) 14 | { 15 | if (this.validate()) 16 | { 17 | let task = "ipconfig"; 18 | 19 | // Async execution 20 | // ****************************** 21 | this.do(task, "cmd_res", false, whatIf); 22 | } 23 | else 24 | { 25 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 26 | } 27 | } 28 | 29 | validate() 30 | { 31 | return true; 32 | } 33 | } 34 | 35 | module.exports = WindowsInterfaces -------------------------------------------------------------------------------- /herd-view/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 31 | } 32 | }; -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_macos_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const UnixJob = require('./rdhd-job-base_unix_job'); 4 | 5 | class MacosJob 6 | { 7 | static get os() { return "MACOS"; } 8 | 9 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 10 | { 11 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 12 | } 13 | // ****************************** 14 | 15 | static killAll(asset, code, binary, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 16 | { 17 | UnixJob.killAll(asset, code, binary, sync, whatIf, wsServer); 18 | } 19 | // ****************************** 20 | 21 | static isAlive(asset, code, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 22 | { 23 | UnixJob.isAlive(asset, code, sync, whatIf, wsServer); 24 | } 25 | // ****************************** 26 | } 27 | 28 | module.exports = MacosJob 29 | -------------------------------------------------------------------------------- /herd-view/src/app/bin/model/module.ts: -------------------------------------------------------------------------------- 1 | import { RedHerdObject } from './base/redherd-common'; 2 | 3 | export enum ModuleMode { 4 | automatic = 'automatic', 5 | interactive = 'interactive', 6 | pivotable = 'pivotable' 7 | } 8 | 9 | export enum ModuleVerb { 10 | execute = 'execute', 11 | interact = 'interact', 12 | pivot = 'pivot', 13 | configure = 'configure', 14 | resume = 'resume', 15 | none = '' 16 | } 17 | 18 | export interface Module extends RedHerdObject { 19 | name: string; 20 | title: string; 21 | description: string; 22 | binary: string; 23 | author: string; 24 | topic: string; 25 | version: string; 26 | params: ModuleParam[]; 27 | tags: string[]; 28 | } 29 | 30 | export interface ModuleParam { 31 | label: string; 32 | name: string; 33 | type: string; 34 | values?: string[]; 35 | } 36 | 37 | export interface ModuleInstance { 38 | session: string; 39 | result?: {}; 40 | } -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_android_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const UnixJob = require('./rdhd-job-base_unix_job'); 4 | 5 | class AndroidJob 6 | { 7 | static get os() { return "ANDROID"; } 8 | 9 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 10 | { 11 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 12 | } 13 | // ****************************** 14 | 15 | static killAll(asset, code, binary, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 16 | { 17 | UnixJob.killAll(asset, code, binary, sync, whatIf, wsServer); 18 | } 19 | // ****************************** 20 | 21 | static isAlive(asset, code, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 22 | { 23 | UnixJob.isAlive(asset, code, sync, whatIf, wsServer); 24 | } 25 | // ****************************** 26 | } 27 | 28 | module.exports = AndroidJob 29 | -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_centos_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const UnixJob = require('./rdhd-job-base_unix_job'); 4 | 5 | class CentosJob 6 | { 7 | static get os() { return "CENTOS"; } 8 | 9 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 10 | { 11 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 12 | } 13 | // ****************************** 14 | 15 | static killAll(asset, code, binary, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 16 | { 17 | UnixJob.killAll(asset, code, binary, sync, whatIf, wsServer); 18 | } 19 | // ****************************** 20 | 21 | static isAlive(asset, code, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 22 | { 23 | UnixJob.isAlive(asset, code, sync, whatIf, wsServer); 24 | } 25 | // ****************************** 26 | } 27 | 28 | module.exports = CentosJob 29 | -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_debian_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const UnixJob = require('./rdhd-job-base_unix_job'); 4 | 5 | class DebianJob 6 | { 7 | static get os() { return "DEBIAN"; } 8 | 9 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 10 | { 11 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 12 | } 13 | // ****************************** 14 | 15 | static killAll(asset, code, binary, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 16 | { 17 | UnixJob.killAll(asset, code, binary, sync, whatIf, wsServer); 18 | } 19 | // ****************************** 20 | 21 | static isAlive(asset, code, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 22 | { 23 | UnixJob.isAlive(asset, code, sync, whatIf, wsServer); 24 | } 25 | // ****************************** 26 | } 27 | 28 | module.exports = DebianJob 29 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_powerview_forest.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_powerview_forest", 3 | "title": "PowerView Forest Enumeration", 4 | "description": "Active Directory forest enumeration via PowerView script", 5 | "binary": "PowerView.ps1", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [ 10 | { 11 | "label": "Object", 12 | "name": "object", 13 | "type": "list", 14 | "values": [ 15 | "Info", 16 | "Domains", 17 | "Trusts" 18 | ] 19 | }, 20 | { 21 | "label": "Username", 22 | "name": "username", 23 | "type": "string" 24 | }, 25 | { 26 | "label": "Password", 27 | "name": "password", 28 | "type": "string" 29 | }, 30 | { 31 | "label": "Forest (optional)", 32 | "name": "target", 33 | "type": "string" 34 | } 35 | ], 36 | "tags": [ 37 | "automatic" 38 | ] 39 | } -------------------------------------------------------------------------------- /herd-server/bin/job/rdhd-job-tcp_proxy.js: -------------------------------------------------------------------------------- 1 | const TcpProxyFactory = require('../lib/rdhd-lib-tcp_proxy_factory'); 2 | const Validator = require('../lib/rdhd-lib-input_validator'); 3 | 4 | try 5 | { 6 | // ************************************************************ 7 | // Instance specific parameters 8 | // ************************************************************ 9 | let pPort = Validator.validateTcpUdpPort(process.argv[2]) ? process.argv[2] : false; 10 | let rHost = Validator.validateHost(process.argv[3]) ? process.argv[3] : false; 11 | let rPort = Validator.validateTcpUdpPort(process.argv[4]) ? process.argv[4] : false; 12 | 13 | if (pPort && rPort && rHost) 14 | { 15 | // ************************************************************ 16 | // Spawn new tcp proxy 17 | // ************************************************************ 18 | TcpProxyFactory.spawn(pPort, rHost, rPort); 19 | } 20 | } 21 | catch (e) 22 | { 23 | console.log(e); 24 | } -------------------------------------------------------------------------------- /herd-server/bin/job/rdhd-job-udp_proxy.js: -------------------------------------------------------------------------------- 1 | const UdpProxyFactory = require('../lib/rdhd-lib-udp_proxy_factory'); 2 | const Validator = require('../lib/rdhd-lib-input_validator'); 3 | 4 | try 5 | { 6 | // ************************************************************ 7 | // Instance specific parameters 8 | // ************************************************************ 9 | let pPort = Validator.validateTcpUdpPort(process.argv[2]) ? process.argv[2] : false; 10 | let rHost = Validator.validateHost(process.argv[3]) ? process.argv[3] : false; 11 | let rPort = Validator.validateTcpUdpPort(process.argv[4]) ? process.argv[4] : false; 12 | 13 | if (pPort && rPort && rHost) 14 | { 15 | // ************************************************************ 16 | // Spawn new tcp proxy 17 | // ************************************************************ 18 | UdpProxyFactory.spawn(pPort, rHost, rPort); 19 | } 20 | } 21 | catch (e) 22 | { 23 | console.log(e); 24 | } -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-detail-panel/asset-detail-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-expansion-panel { 2 | box-shadow: none; 3 | border-radius: 0; 4 | width: 100%; 5 | margin: auto; 6 | } 7 | 8 | .mat-select, 9 | .mat-input-element { 10 | padding-left: 10px; 11 | padding-right: 10px; 12 | } 13 | 14 | .mat-list-item { 15 | margin-top: 10px; 16 | margin-bottom: 10px; 17 | } 18 | 19 | .mat-raised-button { 20 | margin-left: 10px; 21 | margin-right: 10px; 22 | } 23 | 24 | .mat-form-field { 25 | display: block; 26 | padding-left: 10px; 27 | padding-right: 10px; 28 | width: 100%; 29 | } 30 | 31 | .mat-icon { 32 | margin: 0 10px; 33 | } 34 | 35 | .row-icon { 36 | width: 24px; 37 | height: 24px; 38 | margin-left: 10px; 39 | margin-right: 10px; 40 | } 41 | 42 | .full-width-table { 43 | width: 100%; 44 | } 45 | 46 | .right { 47 | padding-right: 10px; 48 | text-align: right; 49 | } 50 | 51 | .spacer { 52 | flex: 1 1 auto; 53 | } -------------------------------------------------------------------------------- /herd-server/models/base/rdhd-mdl-data_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class DataMapper 4 | { 5 | constructor(connectionBroker, gateway) 6 | { 7 | // Initiate data gateway for instance access 8 | this.gateway = new gateway(connectionBroker); 9 | } 10 | 11 | // Exposed 12 | findById(id) 13 | { 14 | return this.gateway.findById(id); 15 | } 16 | 17 | // Exposed 18 | findAll() 19 | { 20 | return this.gateway.findAll(); 21 | } 22 | 23 | // Exposed 24 | insert(object) 25 | { 26 | return this.gateway.insert(object); 27 | } 28 | 29 | // Exposed 30 | delete(object) 31 | { 32 | return this.gateway.delete(object); 33 | } 34 | 35 | // Exposed 36 | deleteById(objectId) 37 | { 38 | return this.gateway.delete({ id: objectId }); 39 | } 40 | 41 | // Exposed 42 | update(object) 43 | { 44 | return this.gateway.update(object); 45 | } 46 | } 47 | 48 | module.exports = DataMapper; 49 | -------------------------------------------------------------------------------- /herd-server/bin/lib/rdhd-lib-rtsp_redirector_factory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const RtspServer = require('rtsp-streaming-server').default; 4 | const ServiceFinalizer = require('./base/rdhd-lib-service_finalizer'); 5 | 6 | class RtspRedirectorFactory 7 | { 8 | static spawn(sPort, cPort) 9 | { 10 | let result = true; 11 | try 12 | { 13 | let options = { 14 | serverPort: sPort, 15 | clientPort: cPort, 16 | rtpPortStart: 10000, 17 | rtpPortCount: 10000 18 | } 19 | 20 | let server = new RtspServer(options); 21 | 22 | _initiate(server); 23 | } 24 | catch 25 | { 26 | result = false; 27 | } 28 | return result; 29 | } 30 | 31 | static destroy(sPort) 32 | { 33 | return ServiceFinalizer.destroy(sPort); 34 | } 35 | } 36 | 37 | async function _initiate(server) 38 | { 39 | await server.start(); 40 | } 41 | 42 | module.exports = RtspRedirectorFactory; -------------------------------------------------------------------------------- /herd-server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redherd", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "app.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/redherd-project/redherd-framework" 12 | }, 13 | "author": "b4gh33r4 & peco602", 14 | "license": "ISC", 15 | "dependencies": { 16 | "axios": "^0.21.1", 17 | "bcrypt": "^5.0.0", 18 | "body-parser": "^1.19.0", 19 | "cors": "^2.8.5", 20 | "deasync": "^0.1.20", 21 | "express": "^4.17.1", 22 | "express-basic-auth": "^1.2.0", 23 | "express-rate-limit": "^5.1.3", 24 | "get-port": "^5.1.1", 25 | "http-proxy-middleware": "^1.0.3", 26 | "jsonwebtoken": "^8.5.1", 27 | "kill-port": "^1.6.0", 28 | "node-tcp-proxy": "0.0.15", 29 | "rtsp-streaming-server": "^2.0.6", 30 | "socket.io": "^2.3.0", 31 | "socket.io-client": "^2.4.0", 32 | "sqlite-sync": "^0.3.9", 33 | "udp-proxy": "^1.2.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_interfaces.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const LinuxModule = require('../base/rdhd-mod-base_linux_module'); 4 | 5 | // moduleCode: debian_interfaces 6 | class DebianInterfaces extends LinuxModule 7 | { 8 | // ************************************************************ 9 | // Interfaces module 10 | // ************************************************************ 11 | // ************************************************************ 12 | 13 | constructor(asset, context, session, wsServer, token) 14 | { 15 | super(asset, "debian_interfaces", session, wsServer, token); 16 | } 17 | 18 | run(whatIf = false) 19 | { 20 | let task = "sudo echo \"- IPv4\";/sbin/ip -4 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1 | tr -s \" \" \"\t\"; echo \"- IPv6\";/sbin/ip -6 -o a | cut -d ' ' -f 2,7 | cut -d '/' -f 1 | tr -s \" \" \"\t\""; 21 | 22 | // Async execution 23 | // ****************************** 24 | this.do(task, "cmd_res", false, whatIf); 25 | } 26 | } 27 | 28 | module.exports = DebianInterfaces -------------------------------------------------------------------------------- /herd-view/src/app/controls/filemanager/filemanager.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | folderFile Manager 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
-------------------------------------------------------------------------------- /herd-server/bin/job/rdhd-job-process_monitor.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Model = require('../../controllers/rdhd-ctr-model_controller'); 4 | const io = require("socket.io-client"); 5 | 6 | // jobCode: "process_monitor" 7 | class ProcessMonitorJob 8 | { 9 | static get code() { return "process_monitor"; } 10 | 11 | static run(wsServer = "http://localhost:3001/", ignoreSSL = true) 12 | { 13 | let socketOptions = ignoreSSL ? { rejectUnauthorized : false } : { rejectUnauthorized : true }; 14 | 15 | let socket = io(wsServer, socketOptions); 16 | let model = new Model(); 17 | 18 | socket.on("message", (msg) => { 19 | if (/(_res)$/i.test(msg.type)) 20 | { 21 | // TODO: Evaluate a better solution 22 | if ((msg.payload.type.toUpperCase() == "EXTCODE") || (msg.payload.type.toUpperCase() == "EXTMSG")) 23 | { 24 | model.removeProcessBySession(msg.session); 25 | } 26 | } 27 | }); 28 | } 29 | } 30 | 31 | module.exports = ProcessMonitorJob -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_powerview_domain_computers.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_powerview_domain_computers", 3 | "title": "PowerView Domain Computers Enumeration", 4 | "description": "Active Directory domain computers enumeration via PowerView script", 5 | "binary": "PowerView.ps1", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [ 10 | { 11 | "label": "Object", 12 | "name": "object", 13 | "type": "list", 14 | "values": [ 15 | "Computers", 16 | "Operating Systems", 17 | "Unconstrained Delegation", 18 | "Constrained Delegation" 19 | ] 20 | }, 21 | { 22 | "label": "Username", 23 | "name": "username", 24 | "type": "string" 25 | }, 26 | { 27 | "label": "Password", 28 | "name": "password", 29 | "type": "string" 30 | }, 31 | { 32 | "label": "Domain (optional)", 33 | "name": "target", 34 | "type": "string" 35 | } 36 | ], 37 | "tags": [ 38 | "automatic" 39 | ] 40 | } -------------------------------------------------------------------------------- /herd-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16.12.0-bullseye 2 | 3 | RUN apt update && \ 4 | apt install iproute2 lsof -y 5 | 6 | # WeTTY installation 7 | RUN yarn global add wetty@2.0.2 8 | 9 | # App directory creation 10 | RUN mkdir -p /home/node/{app,share} && chown -R node:node /home/node/{app,share} 11 | WORKDIR /home/node/app 12 | COPY . /home/node/app 13 | RUN npm install 14 | #COPY package-lock.json package.json /home/node/app/ 15 | #RUN npm --global config set user root && \ 16 | # npm --global install express 17 | 18 | # Additional binaries installation 19 | RUN mv ./etc/* /usr/bin/ && \ 20 | rm -rf ./etc 21 | #COPY /etc/* /usr/bin/ 22 | 23 | # SSH configuration 24 | RUN echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \ 25 | echo " ConnectTimeout 5" >> /etc/ssh/ssh_config && \ 26 | echo " LogLevel ERROR" >> /etc/ssh/ssh_config && \ 27 | echo " UserKnownHostsFile=/dev/null" >> /etc/ssh/ssh_config && \ 28 | sed -i 's/HashKnownHosts\ yes/HashKnownHosts\ no/g' /etc/ssh/ssh_config 29 | 30 | EXPOSE 3000/tcp 31 | EXPOSE 3001/tcp 32 | 33 | CMD [ "node", "app.js" ] 34 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_powerview_domain.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_powerview_domain", 3 | "title": "PowerView Domain Enumeration", 4 | "description": "Active Directory domain enumeration via PowerView script", 5 | "binary": "PowerView.ps1", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [ 10 | { 11 | "label": "Object", 12 | "name": "object", 13 | "type": "list", 14 | "values": [ 15 | "Info", 16 | "SID", 17 | "Trusts", 18 | "Domain Controllers", 19 | "Organizational Units", 20 | "File Servers", 21 | "Shares" 22 | ] 23 | }, 24 | { 25 | "label": "Username", 26 | "name": "username", 27 | "type": "string" 28 | }, 29 | { 30 | "label": "Password", 31 | "name": "password", 32 | "type": "string" 33 | }, 34 | { 35 | "label": "Domain (optional)", 36 | "name": "target", 37 | "type": "string" 38 | } 39 | ], 40 | "tags": [ 41 | "automatic" 42 | ] 43 | } -------------------------------------------------------------------------------- /herd-server/proto/rdhd-prt-jsend_responses.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | class JSendResponses 4 | { 5 | // JSend spec compliant responses generator 6 | // 7 | // Ref: https://github.com/omniti-labs/jsend 8 | // ****************************** 9 | static success(data) 10 | { 11 | let response = { 12 | status : "success", 13 | data : data 14 | }; 15 | 16 | return response; 17 | } 18 | 19 | static fail(data) 20 | { 21 | let response = { 22 | status : "fail", 23 | data : data 24 | }; 25 | 26 | return response; 27 | } 28 | 29 | static error(message, code = null, data = null) 30 | { 31 | let response = { 32 | status : "error", 33 | message : message, 34 | }; 35 | 36 | if (code) 37 | { 38 | response.code = code; 39 | } 40 | 41 | if (data) 42 | { 43 | response.data = data; 44 | } 45 | return response; 46 | } 47 | } 48 | 49 | module.exports = JSendResponses -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-assets_topics_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class AssetsTopicsGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "assets_topics"); 10 | } 11 | 12 | // Specialized query decorator 13 | findById(id) 14 | { 15 | return this.select("SELECT id, id_asset, id_topic FROM assets_topics WHERE id = ?", [ id ]); 16 | } 17 | 18 | // Specialized query decorator 19 | findAll() 20 | { 21 | return this.select("SELECT id, id_asset, id_topic FROM assets_topics"); 22 | } 23 | 24 | // Specialized query decorator 25 | findByAssetId(id) 26 | { 27 | return this.select("SELECT id, id_asset, id_topic FROM assets_topics WHERE id_asset = ?", [ id ]); 28 | } 29 | 30 | // Specialized query decorator 31 | findByTopicId(id) 32 | { 33 | return this.select("SELECT id, id_asset, id_topic FROM assets_topics WHERE id_topic = ?", [ id ]); 34 | } 35 | } 36 | 37 | module.exports = AssetsTopicsGateway; -------------------------------------------------------------------------------- /herd-view/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(waitForAsync(() => { 6 | TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | })); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'herd-view'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.componentInstance; 22 | expect(app.title).toEqual('herd-view'); 23 | }); 24 | 25 | it('should render title', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.nativeElement; 29 | expect(compiled.querySelector('.content span').textContent).toContain('herd-view app is running!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /herd-view/src/app/services/terminal.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, } from 'rxjs'; 4 | import { RedHerdServiceProvider } from './base/redherd-service-provider'; 5 | import { ServiceResponse, ServiceType } from '../bin/model/service'; 6 | import { Asset } from '../bin/model/asset'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class TerminalService extends RedHerdServiceProvider { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(ServiceType.terminal, http, notifier); 19 | } 20 | 21 | /** POST: enable new terminal service for an asset */ 22 | public start(asset: Asset | number): Observable { 23 | return this.enable(asset); 24 | } 25 | 26 | /** POST: disable a previously requested terminal service */ 27 | public stop(asset: Asset | number): Observable { 28 | return this.disable(asset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/nav-bar/nav-bar.component.css: -------------------------------------------------------------------------------- 1 | .sidenav-container { 2 | height: 100%; 3 | } 4 | 5 | .mat-toolbar.mat-primary { 6 | position: sticky; 7 | top: 0; 8 | z-index: 2; 9 | } 10 | 11 | .spacer { 12 | flex: 1 1 auto; 13 | } 14 | 15 | .mat-icon { 16 | margin: 0 10px; 17 | } 18 | 19 | .footer-logo { 20 | position: fixed; 21 | right: 0; 22 | bottom: 0; 23 | width: 380px; 24 | opacity: 0.5; 25 | z-index: -2; 26 | } 27 | 28 | .bottom-content{ 29 | position: absolute; 30 | bottom: 5px; 31 | left: 0; 32 | right: 0; 33 | } 34 | 35 | .toolbar{ 36 | background-color: transparent; 37 | width: 72px; 38 | } 39 | 40 | .toggle-toolbar-button{ 41 | z-index: 15; 42 | margin-bottom: 10px; 43 | background-color: rgb(66, 66, 66); 44 | color: white; 45 | position: fixed; 46 | } 47 | 48 | ::ng-deep .mat-toolbar-single-row { 49 | height: 48px; 50 | } 51 | 52 | ::ng-deep .mat-drawer-content.mat-sidenav-content { 53 | scrollbar-width: none; 54 | -ms-overflow-style: none; 55 | } 56 | 57 | ::ng-deep .mat-drawer-content.mat-sidenav-content::-webkit-scrollbar { 58 | width: 0 !important 59 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 RedHerd-Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /herd-view/src/app/services/rtsp-redirector.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, } from 'rxjs'; 4 | import { RedHerdServiceProvider } from './base/redherd-service-provider'; 5 | import { ServiceResponse, ServiceType } from '../bin/model/service'; 6 | import { Asset } from '../bin/model/asset'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class RtspRedirectorService extends RedHerdServiceProvider { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(ServiceType.rtsp_redirector, http, notifier); 19 | } 20 | 21 | /** POST: enable new web proxy service for an asset */ 22 | public start(asset: Asset | number): Observable { 23 | return this.enable(asset); 24 | } 25 | 26 | /** POST: disable a previously requested web proxy service */ 27 | public stop(asset: Asset | number): Observable { 28 | return this.disable(asset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /etc/node-file-manager/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 efei 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /herd-view/src/app/services/tcp-proxy.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, } from 'rxjs'; 4 | import { RedHerdServiceProvider } from './base/redherd-service-provider'; 5 | import { ServiceResponse, ServiceType } from '../bin/model/service'; 6 | import { Asset } from '../bin/model/asset'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class TcpProxyService extends RedHerdServiceProvider { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(ServiceType.tcp_proxy, http, notifier); 19 | } 20 | 21 | /** POST: enable new web proxy service for an asset */ 22 | public start(asset: Asset | number, port: number): Observable { 23 | return this.enable(asset, { rport: port }); 24 | } 25 | 26 | /** POST: disable a previously requested web proxy service */ 27 | public stop(asset: Asset | number): Observable { 28 | return this.disable(asset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /herd-view/src/app/services/udp-proxy.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, } from 'rxjs'; 4 | import { RedHerdServiceProvider } from './base/redherd-service-provider'; 5 | import { ServiceResponse, ServiceType } from '../bin/model/service'; 6 | import { Asset } from '../bin/model/asset'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class UdpProxyService extends RedHerdServiceProvider { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(ServiceType.udp_proxy, http, notifier); 19 | } 20 | 21 | /** POST: enable new web proxy service for an asset */ 22 | public start(asset: Asset | number, port: number): Observable { 23 | return this.enable(asset, { rport: port }); 24 | } 25 | 26 | /** POST: disable a previously requested web proxy service */ 27 | public stop(asset: Asset | number): Observable { 28 | return this.disable(asset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /herd-view/src/app/services/web-proxy.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, } from 'rxjs'; 4 | import { RedHerdServiceProvider } from './base/redherd-service-provider'; 5 | import { ServiceResponse, ServiceType } from '../bin/model/service'; 6 | import { Asset } from '../bin/model/asset'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class WebProxyService extends RedHerdServiceProvider { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(ServiceType.http_proxy, http, notifier); 19 | } 20 | 21 | /** POST: enable new web proxy service for an asset */ 22 | public start(asset: Asset | number, port: number): Observable { 23 | return this.enable(asset, { rport: port }); 24 | } 25 | 26 | /** POST: disable a previously requested web proxy service */ 27 | public stop(asset: Asset | number): Observable { 28 | return this.disable(asset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ovpn-server/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Kyle Manna 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /herd-view/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/herd-view'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /herd-view/src/app/services/system.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { RedHerdApi } from './base/redherd-api'; 5 | import { RedHerdEntity, RedHerdRootEndpoint } from '../bin/model/base/redherd-common'; 6 | import { System } from '../bin/model/system'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class SystemService extends RedHerdApi { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(RedHerdRootEndpoint.system, http, notifier); 19 | } 20 | 21 | /** GET: retrieve system context from server */ 22 | public getSystem(): Observable { 23 | //return this.get(RedHerdEntity.system, '').pipe(shareReplay()); 24 | return this.get(RedHerdEntity.system, ''); 25 | } 26 | 27 | /** GET: retrieve system context from server as Promise*/ 28 | public async getSystemPromise(): Promise { 29 | return await this.getSystem().toPromise(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ovpn-server/Dockerfile: -------------------------------------------------------------------------------- 1 | # Original credit: https://github.com/jpetazzo/dockvpn 2 | 3 | # Smallest base image 4 | FROM alpine:latest 5 | 6 | LABEL maintainer="Kyle Manna " 7 | 8 | # Testing: pamtester 9 | RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \ 10 | apk add --update openvpn iptables bash easy-rsa openvpn-auth-pam google-authenticator pamtester && \ 11 | ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ 12 | rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* && \ 13 | touch /etc/openvpn/vars 14 | 15 | # Needed by scripts 16 | ENV OPENVPN /etc/openvpn 17 | ENV EASYRSA /usr/share/easy-rsa 18 | ENV EASYRSA_PKI $OPENVPN/pki 19 | ENV EASYRSA_VARS_FILE $OPENVPN/vars 20 | 21 | # Prevents refused client connection because of an expired CRL 22 | ENV EASYRSA_CRL_DAYS 3650 23 | 24 | VOLUME ["/etc/openvpn"] 25 | 26 | # Internally uses port 1194/udp, remap using `docker run -p 443:1194/tcp` 27 | EXPOSE 1194/udp 28 | 29 | CMD ["ovpn_run"] 30 | 31 | ADD ./bin /usr/local/bin 32 | RUN chmod a+x /usr/local/bin/* 33 | 34 | # Add support for OTP authentication using a PAM module 35 | ADD ./otp/openvpn /etc/pam.d/ 36 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/assets-table/assets-table.component.css: -------------------------------------------------------------------------------- 1 | .mat-card, 2 | .mat-expansion-panel { 3 | box-shadow: none; 4 | border-radius: 0; 5 | } 6 | 7 | .mat-card { 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .mat-input-element { 14 | padding-left: 10px; 15 | padding-right: 10px; 16 | } 17 | 18 | .mat-form-field { 19 | display: block; 20 | padding-left: 10px; 21 | padding-right: 10px; 22 | } 23 | 24 | .mat-icon { 25 | margin: 0 10px; 26 | } 27 | 28 | .mat-cell .mat-icon { 29 | margin: auto; 30 | } 31 | 32 | .full-width-table { 33 | width: 100%; 34 | } 35 | 36 | .terminal, 37 | .details { 38 | color: inherit; 39 | } 40 | 41 | .row-icon { 42 | width: 32px; 43 | height: 32px; 44 | } 45 | 46 | .spacer { 47 | flex: 1 1 auto; 48 | } 49 | 50 | .center { 51 | width: 33%; 52 | text-align: center; 53 | } 54 | 55 | .left { 56 | width: 33%; 57 | text-align: left; 58 | } 59 | 60 | .right { 61 | width: 33%; 62 | text-align: right; 63 | } 64 | 65 | ::ng-deep .mat-tab-label { 66 | margin: 0; 67 | padding: 0; 68 | } 69 | 70 | ::ng-deep .mat-tab-label-content { 71 | width: 100%; 72 | display: contents; 73 | } -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-assets_topics_mapper.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Mapper = require('./base/rdhd-mdl-data_mapper'); 4 | const Gateway = require('./rdhd-mdl-assets_topics_gateway'); 5 | 6 | class AssetsTopicsMapper extends Mapper 7 | { 8 | constructor(connectionBroker) 9 | { 10 | super(connectionBroker, Gateway); 11 | } 12 | 13 | // Specialized query decorator 14 | findByAssetId(id) 15 | { 16 | return this.gateway.findByAssetId(id); 17 | } 18 | 19 | // Specialized query decorator 20 | findByTopicId(id) 21 | { 22 | return this.gateway.findByTopicId(id); 23 | } 24 | 25 | // Specialized delete decorator 26 | deleteByAssetId(id) 27 | { 28 | return this.gateway.delete({}, { id_asset: id }); 29 | } 30 | 31 | // Specialized delete decorator 32 | deleteByTopicId(id) 33 | { 34 | return this.gateway.delete({}, { id_topic: id }); 35 | } 36 | 37 | // Specialized delete decorator 38 | deleteByAssetAndTopicId(assetId, topicId) 39 | { 40 | return this.gateway.delete({}, { id_asset: assetId, id_topic: topicId }); 41 | } 42 | } 43 | 44 | module.exports = AssetsTopicsMapper; 45 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_powerview_domain_users.info: -------------------------------------------------------------------------------- 1 | { 2 | "name": "windows_powerview_domain_users", 3 | "title": "PowerView Domain Users Enumeration", 4 | "description": "Active Directory domain users enumeration via PowerView script", 5 | "binary": "PowerView.ps1", 6 | "author": "b4gh33r4 & peco602", 7 | "topic": "windows_reconnaissance", 8 | "version": "1.0", 9 | "params": [ 10 | { 11 | "label": "Object", 12 | "name": "object", 13 | "type": "list", 14 | "values": [ 15 | "Users", 16 | "E-mails", 17 | "Groups", 18 | "Enterprise Admins", 19 | "Domain Admins", 20 | "Local Admin Access", 21 | "Service Principal Name", 22 | "Constrained Delegation", 23 | "PreAuth Not Required" 24 | ] 25 | }, 26 | { 27 | "label": "Username", 28 | "name": "username", 29 | "type": "string" 30 | }, 31 | { 32 | "label": "Password", 33 | "name": "password", 34 | "type": "string" 35 | }, 36 | { 37 | "label": "Domain (optional)", 38 | "name": "target", 39 | "type": "string" 40 | } 41 | ], 42 | "tags": [ 43 | "automatic" 44 | ] 45 | } -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Shell = require('../../lib/rdhd-lib-web_socket_shell'); 4 | const FSMFPUtils = require('../../../proto/rdhd-prt-fsmfp_utils'); 5 | const Config = require('../../../config'); 6 | 7 | class Job 8 | { 9 | // Job execution function: 10 | // ****************************** 11 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 12 | { 13 | // Create shell object istance 14 | let sh = new Shell('ssh', ['-i', Config.private_key, asset.user + '@' + asset.ip, '-p', asset.wport, task], FSMFPUtils.getSpecializedLv2Message(asset.id, code), wsServer); 15 | 16 | // RedHerd Flexible Message Formatting Protocol compliant JSON envelopes: 17 | if (sync) 18 | { 19 | // Sync execution 20 | // ****************************** 21 | sh.executeSync(whatIf); 22 | } 23 | else 24 | { 25 | // Async execution 26 | // ****************************** 27 | sh.executeAsync(whatIf, false); 28 | } 29 | } 30 | // ****************************** 31 | } 32 | 33 | module.exports = Job 34 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_wifi_interfaces.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const LinuxModule = require('../base/rdhd-mod-base_linux_module'); 4 | 5 | // moduleCode: debian_wifi_interfaces 6 | class DebianWiFiInterfaces extends LinuxModule 7 | { 8 | // ************************************************************ 9 | // WiFiInterfaces module 10 | // ************************************************************ 11 | // ************************************************************ 12 | 13 | constructor(asset, context, session, wsServer, token) 14 | { 15 | super(asset, "debian_wifi_interfaces", session, wsServer, token); 16 | } 17 | 18 | configure(whatIf = false) 19 | { 20 | let task = "sudo apt update; sudo apt install aircrack-ng -y"; 21 | 22 | // Async execution 23 | // ****************************** 24 | this.do(task, "cmd_res", false, whatIf); 25 | } 26 | 27 | run(whatIf = false) 28 | { 29 | let task = "sudo airmon-ng | tail -n +4 | head -n -1"; 30 | 31 | // Async execution 32 | // ****************************** 33 | this.do(task, "cmd_res", false, whatIf); 34 | } 35 | } 36 | 37 | module.exports = DebianWiFiInterfaces -------------------------------------------------------------------------------- /ovpn-server/Dockerfile.aarch64: -------------------------------------------------------------------------------- 1 | # Original credit: https://github.com/jpetazzo/dockvpn 2 | 3 | # Smallest base image 4 | FROM aarch64/alpine:3.5 5 | 6 | LABEL maintainer="Kyle Manna " 7 | 8 | RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && \ 9 | echo "http://dl-4.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \ 10 | apk add --update openvpn iptables bash easy-rsa openvpn-auth-pam google-authenticator pamtester && \ 11 | ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ 12 | rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* 13 | 14 | # Needed by scripts 15 | ENV OPENVPN /etc/openvpn 16 | ENV EASYRSA /usr/share/easy-rsa 17 | ENV EASYRSA_PKI $OPENVPN/pki 18 | ENV EASYRSA_VARS_FILE $OPENVPN/vars 19 | 20 | # Prevents refused client connection because of an expired CRL 21 | ENV EASYRSA_CRL_DAYS 3650 22 | 23 | VOLUME ["/etc/openvpn"] 24 | 25 | # Internally uses port 1194/udp, remap using `docker run -p 443:1194/tcp` 26 | EXPOSE 1194/udp 27 | 28 | CMD ["ovpn_run"] 29 | 30 | ADD ./bin /usr/local/bin 31 | RUN chmod a+x /usr/local/bin/* 32 | 33 | # Add support for OTP authentication using a PAM module 34 | ADD ./otp/openvpn /etc/pam.d/ 35 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/assets-table/assets-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | import { MatPaginatorModule } from '@angular/material/paginator'; 4 | import { MatSortModule } from '@angular/material/sort'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | 7 | import { AssetsTableComponent } from './assets-table.component'; 8 | 9 | describe('AssetsTableComponent', () => { 10 | let component: AssetsTableComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(waitForAsync(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ AssetsTableComponent ], 16 | imports: [ 17 | NoopAnimationsModule, 18 | MatPaginatorModule, 19 | MatSortModule, 20 | MatTableModule, 21 | ] 22 | }).compileComponents(); 23 | })); 24 | 25 | beforeEach(() => { 26 | fixture = TestBed.createComponent(AssetsTableComponent); 27 | component = fixture.componentInstance; 28 | fixture.detectChanges(); 29 | }); 30 | 31 | it('should compile', () => { 32 | expect(component).toBeTruthy(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/modules-table/modules-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | import { MatPaginatorModule } from '@angular/material/paginator'; 4 | import { MatSortModule } from '@angular/material/sort'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | 7 | import { ModulesTableComponent } from './modules-table.component'; 8 | 9 | describe('ModulesTableComponent', () => { 10 | let component: ModulesTableComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(waitForAsync(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ ModulesTableComponent ], 16 | imports: [ 17 | NoopAnimationsModule, 18 | MatPaginatorModule, 19 | MatSortModule, 20 | MatTableModule, 21 | ] 22 | }).compileComponents(); 23 | })); 24 | 25 | beforeEach(() => { 26 | fixture = TestBed.createComponent(ModulesTableComponent); 27 | component = fixture.componentInstance; 28 | fixture.detectChanges(); 29 | }); 30 | 31 | it('should compile', () => { 32 | expect(component).toBeTruthy(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-asset_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class AssetGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "assets"); 10 | } 11 | 12 | // Specialized query decorator 13 | findById(id) 14 | { 15 | return this.select("SELECT id, name, ip, description, user, fingerprint, wport, joined, id_type FROM assets WHERE id = ?", [ id ])[0]; 16 | } 17 | 18 | // Specialized query decorator 19 | findByName(name) 20 | { 21 | return this.select("SELECT id, name, ip, description, user, fingerprint, wport, joined, id_type FROM assets WHERE name = ?", [ name ])[0]; 22 | } 23 | 24 | // Specialized query decorator 25 | findByFingerprint(fingerprint) 26 | { 27 | return this.select("SELECT id, name, ip, description, user, fingerprint, wport, joined, id_type FROM assets WHERE fingerprint = ?", [ fingerprint ])[0]; 28 | } 29 | 30 | // Specialized query decorator 31 | findAll() 32 | { 33 | return this.select("SELECT id, name, ip, description, user, fingerprint, wport, joined, id_type FROM assets"); 34 | } 35 | } 36 | 37 | module.exports = AssetGateway; -------------------------------------------------------------------------------- /ovpn-server/bin/ovpn_otp_user: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Generate OpenVPN users via google authenticator 5 | # 6 | 7 | if ! source "$OPENVPN/ovpn_env.sh"; then 8 | echo "Could not source $OPENVPN/ovpn_env.sh." 9 | exit 1 10 | fi 11 | 12 | if [ "x$OVPN_OTP_AUTH" != "x1" ]; then 13 | echo "OTP authentication not enabled, please regenerate configuration using -2 flag" 14 | exit 1 15 | fi 16 | 17 | if [ -z $1 ]; then 18 | echo "Usage: ovpn_otp_user USERNAME" 19 | exit 1 20 | fi 21 | 22 | # Ensure the otp folder is present 23 | [ -d /etc/openvpn/otp ] || mkdir -p /etc/openvpn/otp 24 | 25 | # Binary is present in image, save an $user.google_authenticator file in /etc/openvpn/otp 26 | if [ "$2" == "interactive" ]; then 27 | # Authenticator will ask for other parameters. User can choose rate limit, token reuse policy and time window policy 28 | # Always use time base OTP otherwise storage for counters must be configured somewhere in volume 29 | google-authenticator --time-based --force -l "${1}@${OVPN_CN}" -s /etc/openvpn/otp/${1}.google_authenticator 30 | else 31 | google-authenticator --time-based --disallow-reuse --force --rate-limit=3 --rate-time=30 --window-size=3 \ 32 | -l "${1}@${OVPN_CN}" -s /etc/openvpn/otp/${1}.google_authenticator 33 | fi -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | *.sqlite3 29 | 30 | # OS generated files # 31 | ###################### 32 | .DS_Store 33 | .DS_Store? 34 | ._* 35 | .Spotlight-V100 36 | .Trashes 37 | ehthumbs.db 38 | Thumbs.db 39 | 40 | # IDE files # 41 | ############# 42 | nbproject 43 | .~lock.* 44 | .buildpath 45 | .idea 46 | .project 47 | .settings 48 | composer.lock 49 | .vscode/* 50 | 51 | # OpenVPN files # 52 | ################# 53 | ovpn-configs/* 54 | 55 | # Distribution files # 56 | ###################### 57 | *.htpasswd 58 | distribution.conf 59 | plain 60 | 61 | # SMB shared folder # 62 | ##################### 63 | share 64 | 65 | # SSL # 66 | ####### 67 | *.crt 68 | *.key 69 | *.srl 70 | *.csr 71 | *.pem 72 | 73 | # Compiled binaries # 74 | ##################### 75 | herd-server/etc/node-file-manager 76 | 77 | # NodeJS modules # 78 | ################## 79 | node_modules 80 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/nav-bar/nav-bar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewChild } from '@angular/core'; 2 | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; 3 | import { Observable } from 'rxjs'; 4 | import { map, shareReplay } from 'rxjs/operators'; 5 | import { MatSidenav } from '@angular/material/sidenav'; 6 | import { AuthService } from '../../bin/auth/auth.service' 7 | 8 | @Component({ 9 | selector: 'app-nav-bar', 10 | templateUrl: './nav-bar.component.html', 11 | styleUrls: ['./nav-bar.component.css'] 12 | }) 13 | export class NavBarComponent { 14 | isLoggedIn$: Observable; 15 | isHandset$: Observable; 16 | 17 | @ViewChild('drawer') sidenav: MatSidenav; 18 | 19 | constructor(private breakpointObserver: BreakpointObserver, private authService: AuthService) { 20 | this.isLoggedIn$ = this.authService.isLoggedIn; 21 | this.isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset) 22 | .pipe( 23 | map(result => result.matches), 24 | shareReplay() 25 | ); 26 | } 27 | 28 | ngOnInit() {} 29 | 30 | public onLogout(): void { 31 | this.authService.logout(); 32 | } 33 | 34 | public toggle(): void { 35 | if (this.sidenav) { 36 | this.sidenav.toggle(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/processes-table/processes-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | import { MatPaginatorModule } from '@angular/material/paginator'; 4 | import { MatSortModule } from '@angular/material/sort'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | 7 | import { ProcessesTableComponent } from './processes-table.component'; 8 | 9 | describe('ProcessesTableComponent', () => { 10 | let component: ProcessesTableComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(waitForAsync(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ ProcessesTableComponent ], 16 | imports: [ 17 | NoopAnimationsModule, 18 | MatPaginatorModule, 19 | MatSortModule, 20 | MatTableModule, 21 | ] 22 | }).compileComponents(); 23 | })); 24 | 25 | beforeEach(() => { 26 | fixture = TestBed.createComponent(ProcessesTableComponent); 27 | component = fixture.componentInstance; 28 | fixture.detectChanges(); 29 | }); 30 | 31 | it('should compile', () => { 32 | expect(component).toBeTruthy(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /ovpn-server/bin/ovpn_copy_server_files: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## @licence MIT 3 | ## @author Copyright (C) 2015 Robin Schneider 4 | 5 | set -e 6 | 7 | if [ -z "$OPENVPN" ]; then 8 | export OPENVPN="$PWD" 9 | fi 10 | if ! source "$OPENVPN/ovpn_env.sh"; then 11 | echo "Could not source $OPENVPN/ovpn_env.sh." 12 | exit 1 13 | fi 14 | 15 | TARGET="$OPENVPN/server" 16 | if [ -n "$1" ]; then 17 | TARGET="$1" 18 | fi 19 | mkdir -p "${TARGET}" 20 | 21 | ## Ensure that no other keys then the one for the server is present. 22 | rm -rf "$TARGET/pki/private" "$TARGET/pki/issued" 23 | 24 | FILES=( 25 | "openvpn.conf" 26 | "ovpn_env.sh" 27 | "pki/private/${OVPN_CN}.key" 28 | "pki/issued/${OVPN_CN}.crt" 29 | "pki/dh.pem" 30 | "pki/ta.key" 31 | "pki/ca.crt" 32 | "ccd" 33 | ) 34 | 35 | if [ -f "${OPENVPN}/pki/crl.pem" ]; then 36 | FILES+=("pki/crl.pem") 37 | fi 38 | 39 | # Ensure the ccd directory exists, even if empty 40 | mkdir -p "ccd" 41 | 42 | # rsync isn't available to keep size down 43 | # cp --parents isn't in busybox version 44 | # hack the directory structure with tar 45 | tar cf - -C "${OPENVPN}" "${FILES[@]}" | tar xvf - -C "${TARGET}" 46 | 47 | echo "Created the openvpn configuration for the server: $TARGET" 48 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-module-panel/asset-module-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | import { MatPaginatorModule } from '@angular/material/paginator'; 4 | import { MatSortModule } from '@angular/material/sort'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | 7 | import { AssetModulePanelComponent } from './asset-module-panel.component'; 8 | 9 | describe('AssetModulePanelComponent', () => { 10 | let component: AssetModulePanelComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(waitForAsync(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ AssetModulePanelComponent ], 16 | imports: [ 17 | NoopAnimationsModule, 18 | MatPaginatorModule, 19 | MatSortModule, 20 | MatTableModule, 21 | ] 22 | }).compileComponents(); 23 | })); 24 | 25 | beforeEach(() => { 26 | fixture = TestBed.createComponent(AssetModulePanelComponent); 27 | component = fixture.componentInstance; 28 | fixture.detectChanges(); 29 | }); 30 | 31 | it('should compile', () => { 32 | expect(component).toBeTruthy(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-process-panel/asset-process-panel.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 3 | import { MatPaginatorModule } from '@angular/material/paginator'; 4 | import { MatSortModule } from '@angular/material/sort'; 5 | import { MatTableModule } from '@angular/material/table'; 6 | 7 | import { AssetProcessPanelComponent } from './asset-process-panel.component'; 8 | 9 | describe('AssetProcessPanelComponent', () => { 10 | let component: AssetProcessPanelComponent; 11 | let fixture: ComponentFixture; 12 | 13 | beforeEach(waitForAsync(() => { 14 | TestBed.configureTestingModule({ 15 | declarations: [ AssetProcessPanelComponent ], 16 | imports: [ 17 | NoopAnimationsModule, 18 | MatPaginatorModule, 19 | MatSortModule, 20 | MatTableModule, 21 | ] 22 | }).compileComponents(); 23 | })); 24 | 25 | beforeEach(() => { 26 | fixture = TestBed.createComponent(AssetProcessPanelComponent); 27 | component = fixture.componentInstance; 28 | fixture.detectChanges(); 29 | }); 30 | 31 | it('should compile', () => { 32 | expect(component).toBeTruthy(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /herd-view/src/app/services/process.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { RedHerdApi } from './base/redherd-api'; 5 | import { RedHerdEntity, RedHerdRootEndpoint } from '../bin/model/base/redherd-common'; 6 | import { Process } from '../bin/model/process'; 7 | import { NotificationsService } from 'angular2-notifications'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class ProcessService extends RedHerdApi { 13 | 14 | constructor( 15 | protected http: HttpClient, 16 | protected notifier: NotificationsService 17 | ) { 18 | super(RedHerdRootEndpoint.processes, http, notifier); 19 | } 20 | 21 | /** GET: retrieve processes from server */ 22 | public getProcesses(): Observable { 23 | return this.getAll(RedHerdEntity.processes); 24 | } 25 | 26 | /** GET: retrieve process by id */ 27 | public getProcess(id: number): Observable { 28 | return this.get(RedHerdEntity.process, id); 29 | } 30 | 31 | /** DELETE: delete process from server */ 32 | public deleteProcess(process: Process | number): Observable { 33 | const id = typeof process === 'number' ? process : process.id; 34 | 35 | return this.delete(id); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/filemanager/filemanager.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Config } from 'src/app/config'; 3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; 4 | import { Location } from '@angular/common'; 5 | import { FilemanagerService } from 'src/app/services/filemanager.service'; 6 | 7 | @Component({ 8 | selector: 'app-filemanager', 9 | templateUrl: './filemanager.component.html', 10 | styleUrls: ['./filemanager.component.css'] 11 | }) 12 | export class FilemanagerComponent implements OnInit { 13 | private filemanagerUrl: string = Config.filemanager_url; 14 | filemanagerUrlSafe: SafeResourceUrl; 15 | filemanagerReady: boolean = false; 16 | 17 | constructor(private sanitizer: DomSanitizer, private filemanagerService: FilemanagerService, private location: Location) { 18 | this.filemanagerUrlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.filemanagerUrl + '?t=' + this.filemanagerService.Token.value); 19 | } 20 | 21 | ngOnInit(): void { 22 | setTimeout(() => this.filemanagerReady = true, 3000); 23 | } 24 | 25 | public back(): void { 26 | this.location.back(); 27 | } 28 | 29 | public openInNew(): void { 30 | window.open(this.filemanagerUrl + '?t=' + this.filemanagerService.Token.value, "_blank"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /etc/node-file-manager/lib/tools.js: -------------------------------------------------------------------------------- 1 | var fs = require('co-fs'); 2 | var FilePath = require('./fileMap').filePath; 3 | 4 | module.exports = { 5 | realIp: function * (next) { 6 | this.req.ip = this.headers['x-forwarded-for'] || this.ip; 7 | yield *next; 8 | }, 9 | 10 | handelError: function * (next) { 11 | try { 12 | yield * next; 13 | } catch (err) { 14 | this.status = err.status || 500; 15 | this.body = err.message; 16 | C.logger.error(err.stack); 17 | this.app.emit('error', err, this); 18 | } 19 | }, 20 | 21 | loadRealPath: function *(next) { 22 | // router url format must be /api/(.*) 23 | this.request.fPath = FilePath(this.params[0]); 24 | C.logger.info(this.request.fPath); 25 | yield * next; 26 | }, 27 | 28 | checkPathExists: function *(next) { 29 | // Must after loadRealPath 30 | if (!(yield fs.exists(this.request.fPath))) { 31 | this.status = 404; 32 | this.body = 'Path Not Exists!'; 33 | } 34 | else { 35 | yield * next; 36 | } 37 | }, 38 | 39 | checkPathNotExists: function *(next) { 40 | // Must after loadRealPath 41 | if (yield fs.exists(this.request.fPath)) { 42 | this.status = 400; 43 | this.body = 'Path Has Exists!'; 44 | } 45 | else { 46 | yield * next; 47 | } 48 | } 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /ovpn-server/bin/ovpn_initpki: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Initialize the EasyRSA PKI 5 | # 6 | 7 | if [ "$DEBUG" == "1" ]; then 8 | set -x 9 | fi 10 | 11 | set -e 12 | 13 | source "$OPENVPN/ovpn_env.sh" 14 | 15 | # Specify "nopass" as arg[2] to make the CA insecure (not recommended!) 16 | nopass=$1 17 | 18 | # Provides a sufficient warning before erasing pre-existing files 19 | easyrsa init-pki 20 | 21 | # CA always has a password for protection in event server is compromised. The 22 | # password is only needed to sign client/server certificates. No password is 23 | # needed for normal OpenVPN operation. 24 | easyrsa --batch build-ca $nopass 25 | 26 | easyrsa gen-dh 27 | openvpn --genkey --secret $EASYRSA_PKI/ta.key 28 | 29 | # Was nice to autoset, but probably a bad idea in practice, users should 30 | # have to explicitly specify the common name of their server 31 | #if [ -z "$cn"]; then 32 | # #TODO: Handle IPv6 (when I get a VPS with IPv6)... 33 | # ip4=$(dig +short myip.opendns.com @resolver1.opendns.com) 34 | # ptr=$(dig +short -x $ip4 | sed -e 's:\.$::') 35 | # 36 | # [ -n "$ptr" ] && cn=$ptr || cn=$ip4 37 | #fi 38 | 39 | # For a server key with a password, manually init; this is autopilot 40 | easyrsa --batch build-server-full "$OVPN_CN" nopass 41 | 42 | # Generate the CRL for client/server certificates revocation. 43 | easyrsa gen-crl 44 | -------------------------------------------------------------------------------- /herd-view/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { AuthGuard } from './bin/auth/auth.guard' 4 | import { AssetsBoardComponent } from './controls/assets-board/assets-board.component'; 5 | import { ProcessesTableComponent } from './controls/processes-table/processes-table.component'; 6 | import { ModulesBoardComponent } from './controls/modules-board/modules-board.component'; 7 | import { LoginPanelComponent } from './controls/login-panel/login-panel.component'; 8 | import { FilemanagerComponent } from './controls/filemanager/filemanager.component'; 9 | 10 | const routes: Routes = [ 11 | { path: '', redirectTo: '/assets', pathMatch: 'full' }, 12 | { path: 'assets', component: AssetsBoardComponent, canActivate: [AuthGuard] }, 13 | { path: 'processes', component: ProcessesTableComponent, canActivate: [AuthGuard] }, 14 | { path: 'modules', component: ModulesBoardComponent, canActivate: [AuthGuard] }, 15 | { path: 'filemanager', component: FilemanagerComponent, canActivate: [AuthGuard] }, 16 | { path: 'login', component: LoginPanelComponent } 17 | ]; 18 | 19 | @NgModule({ 20 | imports: [ 21 | RouterModule.forRoot(routes, { useHash: true, relativeLinkResolution: 'legacy' }) 22 | ], 23 | exports: [ 24 | RouterModule 25 | ] 26 | }) 27 | export class AppRoutingModule {} 28 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-sqlite_connection_broker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const sqlite = require('sqlite-sync'); 4 | 5 | class SqliteConnectionBroker 6 | { 7 | constructor(db) 8 | { 9 | this._db = db; 10 | } 11 | 12 | // Open database connection 13 | connect(verbose = false) 14 | { 15 | try 16 | { 17 | sqlite.close(); 18 | if (verbose) 19 | { 20 | console.log("Database connection already established"); 21 | } 22 | } 23 | catch 24 | { 25 | if (verbose) 26 | { 27 | console.log("Establish new database connection"); 28 | } 29 | } 30 | finally 31 | { 32 | sqlite.connect(this._db); 33 | } 34 | return sqlite; 35 | } 36 | 37 | // Close database connection 38 | close(verbose = false) 39 | { 40 | try 41 | { 42 | sqlite.close(); 43 | if (verbose) 44 | { 45 | console.log("Database connection closed"); 46 | } 47 | } 48 | catch 49 | { 50 | if (verbose) 51 | { 52 | console.log("No existing database connection"); 53 | } 54 | } 55 | } 56 | } 57 | 58 | module.exports = SqliteConnectionBroker; -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-form/login-form.component.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /etc/node-file-manager/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-file-manager", 3 | "version": "0.4.6", 4 | "description": "File manager web based on Koa and Angular.js", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node --harmony ./lib/index.js" 8 | }, 9 | "bin": "./lib/index.js", 10 | "dependencies": { 11 | "co": "^4.6.0", 12 | "co-busboy": "1.3.1", 13 | "co-from-stream": "0.0.0", 14 | "co-fs": "^1.2.0", 15 | "co-fs-extra": "^1.1.0", 16 | "co-views": "^2.1.0", 17 | "ejs": "^2.3.4", 18 | "jszip": "^3.1.3", 19 | "koa": "^1.0.0", 20 | "koa-bodyparser": "^2.0.1", 21 | "koa-morgan": "^0.3.0", 22 | "koa-mount": "^1.3.0", 23 | "koa-router": "^5.1.2", 24 | "koa-static": "^1.4.9", 25 | "optimist": "^0.5.2", 26 | "tracer": "^0.8.0" 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/efeiefei/node-file-manager.git" 31 | }, 32 | "keywords": [ 33 | "files", 34 | "manager", 35 | "koa", 36 | "angular", 37 | "web", 38 | "server" 39 | ], 40 | "author": { 41 | "name": "efei", 42 | "email": "efeigm@gmail.com" 43 | }, 44 | "license": "MIT", 45 | "bugs": { 46 | "url": "https://github.com/efeiefei/node-file-manager/issues" 47 | }, 48 | "homepage": "https://github.com/efeiefei/node-file-manager#readme", 49 | "pkg": { 50 | "assets": "lib/**/*" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /etc/node-file-manager/lib/public/css/custom.css: -------------------------------------------------------------------------------- 1 | .material-icons.mat-primary { 2 | color: rgb(244, 67, 54); 3 | vertical-align: middle; 4 | } 5 | 6 | .mat-raised-button{ 7 | color: white; 8 | background-color: rgb(48, 48, 48); 9 | } 10 | 11 | .mat-raised-button:hover{ 12 | color: white; 13 | background-color: rgb(66, 66, 66); 14 | } 15 | 16 | .button-icon { 17 | vertical-align: middle; 18 | } 19 | 20 | .breadcrumb { 21 | background-color: rgb(244, 67, 54) !important; 22 | } 23 | 24 | a.path-link { 25 | font-weight: bold; 26 | color: white; 27 | } 28 | 29 | thead { 30 | width: calc( 100% - 1em ) /* scrollbar is average 1em/16px width, remove it from thead width */ 31 | } 32 | 33 | tbody { 34 | display: block; 35 | height: calc( 100vh - 200px ); 36 | overflow: auto; 37 | } 38 | 39 | thead, tbody tr { 40 | display: table; 41 | width: 100%; 42 | table-layout: fixed; 43 | color: white; 44 | } 45 | 46 | td, th { 47 | vertical-align: middle !important; 48 | } 49 | 50 | tbody tr.sortable:hover { 51 | background-color: rgb(48, 48, 48); 52 | } 53 | 54 | .td-middle { 55 | text-align: center; 56 | } 57 | 58 | .main-container { 59 | margin: auto; 60 | width: 95%; 61 | display: block; 62 | } 63 | 64 | input.form-control { 65 | height: inherit; 66 | } 67 | 68 | body { 69 | overflow: hidden; 70 | background-color: rgb(66, 66, 66); 71 | } 72 | -------------------------------------------------------------------------------- /herd-server/proto/rdhd-prt-fsmfp_utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const FSMFPMessages = require('./rdhd-prt-fsmfp_messages'); 4 | 5 | class FSMFPUtils 6 | { 7 | // RedHerd Flexible Message Formatting Protocol compliant decorator: 8 | // ****************************** 9 | 10 | static getSpecializedLv2Message(src, dst, session = "0", type = "gen_res") 11 | { 12 | // RedHerd Flexible Message Formatting Protocol compliant decorator: 13 | // Message format spec.: { "src": "", "dst": "", "payload": "", "session": "" } 14 | let w = {}; 15 | Object.assign(w, FSMFPMessages.genericLv2Message); 16 | 17 | w.src = src.toString(); 18 | w.dst = dst.toString(); 19 | w.type = type.toString(); 20 | w.session = session.toString(); 21 | 22 | return w; 23 | } 24 | 25 | static getSpecializedLv1Message(id, timestamp, type, content) 26 | { 27 | // RedHerd Flexible Message Formatting Protocol compliant decorator: 28 | // Message format spec.: { "id": "", "timestamp": "", "type": "", "content": "" } 29 | // ****************************** 30 | let w = {}; 31 | Object.assign(w, FSMFPMessages.genericLv1Message); 32 | 33 | w.id = id.toString(); 34 | w.timestamp = timestamp; 35 | w.content = content; 36 | w.type = type.toString(); 37 | 38 | return w; 39 | } 40 | } 41 | module.exports = FSMFPUtils -------------------------------------------------------------------------------- /herd-view/src/app/controls/login-form/login-form.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, Validators } from '@angular/forms'; 3 | import { AuthService } from '../../bin/auth/auth.service'; 4 | 5 | @Component({ 6 | selector: 'app-login-form', 7 | templateUrl: './login-form.component.html', 8 | styleUrls: ['./login-form.component.css'] 9 | }) 10 | export class LoginFormComponent implements OnInit { 11 | private formSubmitAttempt: boolean; 12 | form: FormGroup; 13 | hide: boolean; 14 | 15 | constructor(private fb: FormBuilder, private authService: AuthService) { 16 | this.hide = true; 17 | } 18 | 19 | ngOnInit() { 20 | this.form = this.fb.group({ 21 | username: ['', Validators.required], 22 | password: ['', Validators.required] 23 | }); 24 | 25 | this.authService.isLoggedIn.subscribe(); 26 | } 27 | 28 | public isFieldInvalid(field: string): boolean { 29 | return ( 30 | (!this.form.get(field).valid && this.form.get(field).touched) || 31 | (this.form.get(field).untouched && this.formSubmitAttempt) 32 | ); 33 | } 34 | 35 | public onKeyDown(event): void { 36 | if (event.keyCode === 13) { 37 | this.onSubmit(); 38 | } 39 | } 40 | 41 | public onSubmit(): void { 42 | if (this.form.valid) { 43 | this.authService.login(this.form.value); 44 | } 45 | this.formSubmitAttempt = true; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /herd-server/bin/job/base/rdhd-job-base_unix_job.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Job = require('./rdhd-job-base_job'); 4 | 5 | const UnixKillMode = { 6 | PKILL: "PKILL", 7 | KILLALL: "KILLALL" 8 | } 9 | 10 | class UnixJob 11 | { 12 | static get os() { return "UNIX"; } 13 | 14 | static do(asset, code, task, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 15 | { 16 | Job.do(asset, code, task, sync, whatIf, wsServer); 17 | } 18 | // ****************************** 19 | 20 | static killAll(asset, code, binary, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001', killMode = UnixKillMode.PKILL) 21 | { 22 | let task = ""; 23 | switch (killMode.toUpperCase()) 24 | { 25 | case UnixKillMode.KILLALL: 26 | task = "sudo killall -9 " + binary; 27 | break; 28 | case UnixKillMode.PKILL: 29 | default: 30 | task = "sudo pkill -9 " + binary; 31 | break; 32 | } 33 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 34 | } 35 | // ****************************** 36 | 37 | static isAlive(asset, code, sync = false, whatIf = false, wsServer = 'http://127.0.0.1:3001') 38 | { 39 | let task = "hostname"; 40 | 41 | UnixJob.do(asset, code, task, sync, whatIf, wsServer); 42 | } 43 | // ****************************** 44 | } 45 | 46 | module.exports = UnixJob -------------------------------------------------------------------------------- /herd-view/src/app/controls/nav-bar/nav-bar.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { LayoutModule } from '@angular/cdk/layout'; 2 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 3 | import { NoopAnimationsModule } from '@angular/platform-browser/animations'; 4 | import { MatButtonModule } from '@angular/material/button'; 5 | import { MatIconModule } from '@angular/material/icon'; 6 | import { MatListModule } from '@angular/material/list'; 7 | import { MatSidenavModule } from '@angular/material/sidenav'; 8 | import { MatToolbarModule } from '@angular/material/toolbar'; 9 | 10 | import { NavBarComponent } from './nav-bar.component'; 11 | 12 | describe('NavBarComponent', () => { 13 | let component: NavBarComponent; 14 | let fixture: ComponentFixture; 15 | 16 | beforeEach(waitForAsync(() => { 17 | TestBed.configureTestingModule({ 18 | declarations: [NavBarComponent], 19 | imports: [ 20 | NoopAnimationsModule, 21 | LayoutModule, 22 | MatButtonModule, 23 | MatIconModule, 24 | MatListModule, 25 | MatSidenavModule, 26 | MatToolbarModule, 27 | ] 28 | }).compileComponents(); 29 | })); 30 | 31 | beforeEach(() => { 32 | fixture = TestBed.createComponent(NavBarComponent); 33 | component = fixture.componentInstance; 34 | fixture.detectChanges(); 35 | }); 36 | 37 | it('should compile', () => { 38 | expect(component).toBeTruthy(); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /herd-server/models/rdhd-mdl-process_gateway.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const DataGateway = require('./base/rdhd-mdl-data_gateway'); 4 | 5 | class ProcessGateway extends DataGateway 6 | { 7 | constructor(connectionBroker) 8 | { 9 | super(connectionBroker, "processes"); 10 | } 11 | 12 | // Specialized query decorator 13 | findById(id) 14 | { 15 | return this.select("SELECT id, module, session, id_asset FROM processes WHERE id = ?", [ id ])[0]; 16 | } 17 | 18 | // Specialized query decorator 19 | findAll() 20 | { 21 | return this.select("SELECT id, module, session, id_asset FROM processes"); 22 | } 23 | 24 | // Specialized query decorator 25 | findByAssetId(id) 26 | { 27 | return this.select("SELECT id, module, session, id_asset FROM processes WHERE id_asset = ?", [ id ])[0]; 28 | } 29 | 30 | // Specialized query decorator 31 | findByModuleName(name) 32 | { 33 | return this.select("SELECT id, module, session, id_asset FROM processes WHERE module = '?'", [ name ])[0]; 34 | } 35 | 36 | // Specialized query decorator 37 | findBySession(session) 38 | { 39 | return this.select("SELECT id, module, session, id_asset FROM processes WHERE session = '?'", [ session ])[0]; 40 | } 41 | 42 | // Specialized delete decorator 43 | deleteBySession(session) 44 | { 45 | return this.delete({}, { session: session }); 46 | } 47 | } 48 | 49 | module.exports = ProcessGateway; -------------------------------------------------------------------------------- /herd-view/src/app/controls/assets-board/assets-board.component.css: -------------------------------------------------------------------------------- 1 | .mat-form-field { 2 | display: block; 3 | padding-left: 10px; 4 | padding-right: 10px; 5 | } 6 | 7 | .mat-icon { 8 | margin: 0 10px; 9 | } 10 | 11 | .mat-cell .mat-icon { 12 | margin: auto; 13 | } 14 | 15 | .mat-tab-header-handset { 16 | width: 100% 17 | } 18 | 19 | .full-width-table { 20 | width: 100%; 21 | } 22 | 23 | .row-icon { 24 | width: 32px; 25 | height: 32px; 26 | } 27 | 28 | .spacer { 29 | flex: 1 1 auto; 30 | } 31 | 32 | .center { 33 | width: 33%; 34 | text-align: center; 35 | } 36 | 37 | .left { 38 | width: 33%; 39 | text-align: left; 40 | } 41 | 42 | .right { 43 | width: 33%; 44 | text-align: right; 45 | } 46 | 47 | .active { 48 | color: deepskyblue; 49 | } 50 | 51 | .disabled { 52 | color: white; 53 | } 54 | 55 | ::ng-deep .mat-tab-body { 56 | margin-top: 48px !important; 57 | } 58 | 59 | ::ng-deep .mat-tab-header { 60 | z-index: 10; 61 | position: fixed !important; 62 | background-color: rgb(66, 66, 66); 63 | width: 100%; 64 | 65 | /* Firefox */ 66 | width: -moz-calc(100% - 73px); 67 | /* WebKit */ 68 | width: -webkit-calc(100% - 73px); 69 | /* Opera */ 70 | width: -o-calc(100% - 73px); 71 | /* Standard */ 72 | width: calc(100% - 73px); 73 | } 74 | 75 | @media (max-width: 960px) { 76 | ::ng-deep .mat-tab-header { 77 | z-index: 10; 78 | position: fixed !important; 79 | background-color: rgb(66, 66, 66); 80 | width: 100%; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /herd-view/src/app/controls/modules-board/modules-board.component.css: -------------------------------------------------------------------------------- 1 | .mat-form-field { 2 | display: block; 3 | padding-left: 10px; 4 | padding-right: 10px; 5 | } 6 | 7 | .mat-icon { 8 | margin: 0 10px; 9 | } 10 | 11 | .mat-cell .mat-icon { 12 | margin: auto; 13 | } 14 | 15 | .mat-tab-header-handset { 16 | width: 100% 17 | } 18 | 19 | .full-width-table { 20 | width: 100%; 21 | } 22 | 23 | .row-icon { 24 | width: 32px; 25 | height: 32px; 26 | } 27 | 28 | .spacer { 29 | flex: 1 1 auto; 30 | } 31 | 32 | .center { 33 | width: 33%; 34 | text-align: center; 35 | } 36 | 37 | .left { 38 | width: 33%; 39 | text-align: left; 40 | } 41 | 42 | .right { 43 | width: 33%; 44 | text-align: right; 45 | } 46 | 47 | .active { 48 | color: deepskyblue; 49 | } 50 | 51 | .disabled { 52 | color: white; 53 | } 54 | 55 | ::ng-deep .mat-tab-body { 56 | margin-top: 48px !important; 57 | } 58 | 59 | ::ng-deep .mat-tab-header { 60 | z-index: 10; 61 | position: fixed !important; 62 | background-color: rgb(66, 66, 66); 63 | width: 100%; 64 | 65 | /* Firefox */ 66 | width: -moz-calc(100% - 73px); 67 | /* WebKit */ 68 | width: -webkit-calc(100% - 73px); 69 | /* Opera */ 70 | width: -o-calc(100% - 73px); 71 | /* Standard */ 72 | width: calc(100% - 73px); 73 | } 74 | 75 | @media (max-width: 960px) { 76 | ::ng-deep .mat-tab-header { 77 | z-index: 10; 78 | position: fixed !important; 79 | background-color: rgb(66, 66, 66); 80 | width: 100%; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/android_ping.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const LinuxModule = require('../base/rdhd-mod-base_linux_module'); 4 | 5 | // moduleCode: android_ping 6 | class AndroidPing extends LinuxModule 7 | { 8 | // ************************************************************ 9 | // AndroidPing module 10 | // ************************************************************ 11 | // target : IP address or FQDN to ping 12 | // ************************************************************ 13 | 14 | constructor(asset, context, session, wsServer, token) 15 | { 16 | super(asset, "android_ping", session, wsServer, token); 17 | 18 | // POST parameters 19 | // ****************************** 20 | this.target = context.target; 21 | } 22 | 23 | run(whatIf = false) 24 | { 25 | if (this.validate()) 26 | { 27 | let task = "ping -c 4 " + this.target; 28 | //let task = "ping " + this.target; 29 | 30 | // Async execution 31 | // ****************************** 32 | this.do(task, "cmd_res", false, whatIf); 33 | } 34 | else 35 | { 36 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 37 | } 38 | } 39 | 40 | validate() 41 | { 42 | if ((this.target) && Validator.validateHost(this.target)) 43 | { 44 | return true; 45 | } 46 | return false; 47 | } 48 | } 49 | 50 | module.exports = AndroidPing -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_sync_ftp_files.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WindowsModule = require('../base/rdhd-mod-base_windows_module'); 4 | 5 | // moduleCode: windows_sync_ftp_files 6 | class WindowsSyncFtpFiles extends WindowsModule 7 | { 8 | // ************************************************************ 9 | // SyncFtpFiles module 10 | // ************************************************************ 11 | // NOTE: this module works from the the asset "$REDHERD_DATA" 12 | // dir to the FTP root dir. 13 | // ************************************************************ 14 | 15 | constructor(asset, context, session, wsServer, token) 16 | { 17 | super(asset, "windows_sync_ftp_files", session, wsServer, token); 18 | 19 | // Local parameters 20 | // ****************************** 21 | this.deleteFromSource = false; 22 | } 23 | 24 | configure(whatIf = false) 25 | { 26 | let task = ""; 27 | 28 | // Async execution 29 | // ****************************** 30 | // this.do(task, "cmd_res", false, whatIf); 31 | } 32 | 33 | run() 34 | { 35 | if (this.validate()) 36 | { 37 | this.syncShare(false, this.deleteFromSource); 38 | } 39 | else 40 | { 41 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 42 | } 43 | } 44 | 45 | validate() 46 | { 47 | return true; 48 | } 49 | } 50 | 51 | module.exports = WindowsSyncFtpFiles -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_sync_asset_files.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WindowsModule = require('../base/rdhd-mod-base_windows_module'); 4 | 5 | // moduleCode: windows_sync_asset_files 6 | class WindowsSyncAssetFiles extends WindowsModule 7 | { 8 | // ************************************************************ 9 | // SyncAssetFiles module 10 | // ************************************************************ 11 | // NOTE: this module works from the FTP root dir to the asset 12 | // "$REDHERD_DATA" dir. 13 | // ************************************************************ 14 | 15 | constructor(asset, context, session, wsServer, token) 16 | { 17 | super(asset, "windows_sync_asset_files", session, wsServer, token); 18 | 19 | // Local parameters 20 | // ****************************** 21 | this.deleteFromSource = false; 22 | } 23 | 24 | configure(whatIf = false) 25 | { 26 | let task = ""; 27 | 28 | // Async execution 29 | // ****************************** 30 | // this.do(task, "cmd_res", false, whatIf); 31 | } 32 | 33 | run() 34 | { 35 | if (this.validate()) 36 | { 37 | this.syncAsset(false, this.deleteFromSource); 38 | } 39 | else 40 | { 41 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 42 | } 43 | } 44 | 45 | validate() 46 | { 47 | return true; 48 | } 49 | } 50 | 51 | module.exports = WindowsSyncAssetFiles -------------------------------------------------------------------------------- /herd-view/src/app/controls/asset-panel/asset-panel.component.css: -------------------------------------------------------------------------------- 1 | .mat-expansion-panel { 2 | box-shadow: none; 3 | border-radius: 0; 4 | width: 100%; 5 | margin: auto; 6 | text-align: center; 7 | } 8 | 9 | .mat-select, 10 | .mat-input-element { 11 | padding-left: 10px; 12 | padding-right: 10px; 13 | } 14 | 15 | .mat-list-item { 16 | margin-top: 10px; 17 | margin-bottom: 10px; 18 | } 19 | 20 | .mat-raised-button { 21 | margin-left: 10px; 22 | margin-right: 10px; 23 | } 24 | 25 | .mat-form-field { 26 | display: block; 27 | padding-left: 10px; 28 | padding-right: 10px; 29 | width: 100%; 30 | } 31 | 32 | .mat-icon { 33 | margin: 0 10px; 34 | } 35 | 36 | .full-width-table { 37 | width: 100%; 38 | } 39 | 40 | .details-panel-table { 41 | height: 520px; 42 | } 43 | 44 | .details-cell { 45 | position: relative; 46 | } 47 | 48 | .details-cell-content { 49 | position: absolute; 50 | top: 0; 51 | left: 0; 52 | width: 100%; 53 | } 54 | 55 | .terminal-cell { 56 | position: relative; 57 | width: 60%; 58 | } 59 | 60 | .terminal-cell-content { 61 | position: absolute; 62 | top: 0; 63 | right: 0; 64 | width: 100%; 65 | } 66 | 67 | .terminal-cell-placeholder { 68 | position: absolute; 69 | right: 0; 70 | top: 0; 71 | width: 100%; 72 | } 73 | 74 | .terminal-cell-placeholder-image { 75 | object-fit: contain; 76 | width: 100%; 77 | } 78 | 79 | .spacer { 80 | flex: 1 1 auto; 81 | } 82 | 83 | .capitalize { 84 | text-transform: capitalize; 85 | } -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_sync_ftp_files.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const LinuxModule = require('../base/rdhd-mod-base_linux_module'); 4 | 5 | // moduleCode: debian_sync_ftp_files 6 | class DebianSyncFtpFiles extends LinuxModule 7 | { 8 | // ************************************************************ 9 | // SyncFtpFiles module 10 | // ************************************************************ 11 | // NOTE: this module works from the the asset "$REDHERD_DATA" 12 | // dir to the FTP root dir. 13 | // ************************************************************ 14 | 15 | constructor(asset, context, session, wsServer, token) 16 | { 17 | super(asset, "debian_sync_ftp_files", session, wsServer, token); 18 | 19 | // Local parameters 20 | // ****************************** 21 | this.deleteFromSource = false; 22 | } 23 | 24 | configure(whatIf = false) 25 | { 26 | let task = "sudo apt update; sudo apt install lftp -y"; 27 | 28 | // Async execution 29 | // ****************************** 30 | this.do(task, "cmd_res", false, whatIf); 31 | } 32 | 33 | run() 34 | { 35 | if (this.validate()) 36 | { 37 | this.syncShare(false, this.deleteFromSource); 38 | } 39 | else 40 | { 41 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 42 | } 43 | } 44 | 45 | validate() 46 | { 47 | return true; 48 | } 49 | } 50 | 51 | module.exports = DebianSyncFtpFiles -------------------------------------------------------------------------------- /herd-server/bin/module/collection/debian_sync_asset_files.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const LinuxModule = require('../base/rdhd-mod-base_linux_module'); 4 | 5 | // moduleCode: debian_sync_asset_files 6 | class DebianSyncAssetFiles extends LinuxModule 7 | { 8 | // ************************************************************ 9 | // SyncAssetFiles module 10 | // ************************************************************ 11 | // NOTE: this module works from the FTP root dir to the asset 12 | // "$REDHERD_DATA" dir. 13 | // ************************************************************ 14 | 15 | constructor(asset, context, session, wsServer, token) 16 | { 17 | super(asset, "debian_sync_asset_files", session, wsServer, token); 18 | 19 | // Local parameters 20 | // ****************************** 21 | this.deleteFromSource = false; 22 | } 23 | 24 | configure(whatIf = false) 25 | { 26 | let task = "sudo apt update; sudo apt install lftp -y"; 27 | 28 | // Async execution 29 | // ****************************** 30 | this.do(task, "cmd_res", false, whatIf); 31 | } 32 | 33 | run() 34 | { 35 | if (this.validate()) 36 | { 37 | this.syncAsset(false, this.deleteFromSource); 38 | } 39 | else 40 | { 41 | this.reportAndExit(this.buildErrorMessage("Invalid input provided")); 42 | } 43 | } 44 | 45 | validate() 46 | { 47 | return true; 48 | } 49 | } 50 | 51 | module.exports = DebianSyncAssetFiles -------------------------------------------------------------------------------- /herd-view/src/app/services/base/redherd-auth-provider.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Observable, throwError } from 'rxjs'; 3 | import { catchError, map } from 'rxjs/operators'; 4 | import { JSendResponse, JSendResponseInspector } from '../../bin/model/jsend'; 5 | import { RedHerdApiContext } from './redherd-api'; 6 | import { RedHerdRootEndpoint, RedHerdEntity } from '../../bin/model/base/redherd-common'; 7 | import { JwtToken } from '../../bin/model/token'; 8 | import { NotificationsService } from 'angular2-notifications'; 9 | 10 | export class RedHerdAuthProvider { 11 | protected context: RedHerdApiContext; 12 | 13 | constructor(protected http: HttpClient, 14 | protected notifier: NotificationsService) { 15 | this.context = new RedHerdApiContext(RedHerdRootEndpoint.login); 16 | } 17 | 18 | /** POST: user auth */ 19 | public authenticate(username: string, password: string): Observable { 20 | const url = `${this.context.Url}`; 21 | const options = this.context.HttpOptions; 22 | const request = { username: username, password: password }; 23 | 24 | return this.http.post(url, request, options) 25 | .pipe( 26 | map(res => { 27 | let inspected = JSendResponseInspector.inspect(res, this.notifier, RedHerdEntity.token); 28 | if (!inspected.data) { 29 | inspected.notify(); 30 | } 31 | return new JwtToken(inspected.data); 32 | }), 33 | catchError(err => { return throwError(err); }) 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /herd-server/bin/module/collection/windows_persistent_ping.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const WindowsModule = require('../base/rdhd-mod-base_windows_module'); 4 | //const Validator = require('../../lib/rdhd-lib-input_validator'); 5 | 6 | // moduleCode: windows_persistent_ping 7 | class WindowsPersistentPing extends WindowsModule 8 | { 9 | // ************************************************************ 10 | // Ping module 11 | // ************************************************************ 12 | // target : IP address or FQDN to ping 13 | // ************************************************************ 14 | 15 | constructor(asset, context, session, wsServer, token) 16 | { 17 | super(asset, "windows_persistent_ping", session, wsServer, token); 18 | 19 | // POST parameters 20 | // ****************************** 21 | this.target = context.target; 22 | } 23 | 24 | run(whatIf = false) 25 | { 26 | if (this.validate()) 27 | { 28 | let task = "ping " + this.target + " /t"; 29 | 30 | // Async execution 31 | // ****************************** 32 | this.do(task, "cmd_res", false, whatIf); 33 | } 34 | else 35 | { 36 | this.reportAndExit("Invalid input provided"); 37 | } 38 | } 39 | 40 | validate() 41 | { 42 | if ((this.target) && Validator.validateHost(this.target)) 43 | { 44 | return true; 45 | } 46 | return false; 47 | } 48 | } 49 | 50 | module.exports = WindowsPersistentPing -------------------------------------------------------------------------------- /herd-view/src/main.scss: -------------------------------------------------------------------------------- 1 | @use '~@angular/material' as mat; 2 | // Plus imports for other components in your app. 3 | 4 | // Include the common styles for Angular Material. We include this here so that you only 5 | // have to load a single css file for Angular Material in your app. 6 | // Be sure that you only ever include this mixin once! 7 | @include mat.core(); 8 | 9 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 10 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 11 | // hue. Available color palettes: https://material.io/design/color/ 12 | $herd-app-primary: mat.define-palette(mat.$red-palette); 13 | $herd-app-accent: mat.define-palette(mat.$gray-palette, A200, A100, A400); 14 | 15 | // The warn palette is optional (defaults to red). 16 | $herd-app-warn: mat.define-palette(mat.$orange-palette); 17 | 18 | // Create the theme object (a Sass map containing all of the palettes). 19 | $herd-app-theme: mat.define-light-theme($herd-app-primary, $herd-app-accent, $herd-app-warn); 20 | 21 | $herd-app-dark-theme: mat.define-dark-theme( 22 | ( 23 | color: ( 24 | primary: $herd-app-primary, 25 | accent: $herd-app-accent, 26 | warn: $herd-app-warn, 27 | ), 28 | ) 29 | ); 30 | 31 | // Include theme styles for core and each component used in your app. 32 | // Alternatively, you can import and @include the theme mixins for each component 33 | // that you are using. 34 | //@include mat.all-component-themes($herd-app-theme); 35 | @include mat.all-component-themes($herd-app-dark-theme); --------------------------------------------------------------------------------