]> Git Repo - dist-masscan.git/blob - Readme.md
3d2d49e27aa28330b36a322f82c3f9331e2dd0d6
[dist-masscan.git] / Readme.md
1 # Docker file and server to scan the web
2
3 ### Command to build docker container
4 ```
5 $ sudo podman build --cap-add ALL .
6 ```
7
8 ### Command to start server to start and enumerate containers
9 ```
10 $ npm i
11 $ node .
12 ```
13
14 ### Running in Azure
15 You will need to set up a `Template spec` with the following...
16 You will need to change `--YOUR SSH KEY--` to your PCs ssh key.
17
18 ```json
19 {
20         "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
21         "contentVersion": "1.0.0.0",
22         "parameters": {
23                 "location": {
24                         "defaultValue": "[resourceGroup().location]",
25                         "type": "String",
26                         "metadata": {
27                                 "description": "Location for all resources."
28                         }
29                 }
30         },
31         "variables": {
32                 "virtualNetworkName": "[concat(parameters('location'),'-vnet-vmaccess')]",
33                 "networkSecurityGroupsName": "[concat(parameters('location'),'-vnet-vsg')]",
34                 "nicName": "[concat(parameters('location'),'vmka5')]",
35                 "nicNameStr": "[concat(parameters('location'),'strka5')]",
36                 "nicNameNet": "[concat(parameters('location'),'netka5')]",
37                 "publicIPAddressName": "[concat(parameters('location'),'-ipka5')]",
38                 "vnetAddressPrefix": "10.0.0.0/16",
39                 "subnetName": "VMAccess",
40                 "subnetPrefix": "10.0.0.0/24",
41                 "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]"
42         },
43         "resources": [
44                 {
45                         "type": "Microsoft.Network/networkSecurityGroups",
46                         "apiVersion": "2020-11-01",
47                         "name": "[variables('networkSecurityGroupsName')]",
48                         "location": "[parameters('location')]",
49                         "properties": {
50                                 "securityRules": [
51                                         {
52                                                 "name": "SSH",
53                                                 "properties": {
54                                                         "protocol": "TCP",
55                                                         "sourcePortRange": "*",
56                                                         "destinationPortRange": "22",
57                                                         "sourceAddressPrefix": "*",
58                                                         "destinationAddressPrefix": "*",
59                                                         "access": "Allow",
60                                                         "priority": 300,
61                                                         "direction": "Inbound",
62                                                         "sourcePortRanges": [],
63                                                         "destinationPortRanges": [],
64                                                         "sourceAddressPrefixes": [],
65                                                         "destinationAddressPrefixes": []
66                                                 }
67                                         }
68                                 ]
69                         }
70                 },
71                 {
72                         "type": "Microsoft.Storage/storageAccounts",
73                         "apiVersion": "2021-01-01",
74                         "name": "[variables('nicNameStr')]",
75                         "location": "[parameters('location')]",
76                         "sku": {
77                                 "name": "Standard_LRS"
78                         }
79                 },
80                 {
81                         "type": "Microsoft.Network/publicIPAddresses",
82                         "apiVersion": "2020-06-01",
83                         "name": "[variables('publicIPAddressName')]",
84                         "location": "[parameters('location')]",
85                         "properties": {
86                                 "publicIPAllocationMethod": "Dynamic",
87                                 "dnsSettings": {
88                                         "domainNameLabel": "[variables('publicIPAddressName')]"
89                                 }
90                         }
91                 },
92                 {
93                         "type": "Microsoft.Network/virtualNetworks",
94                         "apiVersion": "2020-06-01",
95                         "name": "[variables('virtualNetworkName')]",
96                         "location": "[parameters('location')]",
97                         "properties": {
98                                 "addressSpace": {
99                                         "addressPrefixes": [
100                                                 "[variables('vnetAddressPrefix')]"
101                                         ]
102                                 },
103                                 "subnets": [
104                                         {
105                                                 "name": "[variables('subnetName')]",
106                                                 "properties": {
107                                                         "addressPrefix": "[variables('subnetPrefix')]"
108                                                 }
109                                         }
110                                 ]
111                         }
112                 },
113                 {
114                         "type": "Microsoft.Network/networkInterfaces",
115                         "apiVersion": "2020-06-01",
116                         "name": "[variables('nicNameNet')]",
117                         "location": "[parameters('location')]",
118                         "dependsOn": [
119                                 "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
120                                 "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
121                                 "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupsName'))]"
122                         ],
123                         "properties": {
124                                 "ipConfigurations": [
125                                         {
126                                                 "name": "ipconfig1",
127                                                 "properties": {
128                                                         "privateIPAllocationMethod": "Dynamic",
129                                                         "publicIPAddress": {
130                                                                 "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
131                                                         },
132                                                         "subnet": {
133                                                                 "id": "[variables('subnetRef')]"
134                                                         }
135                                                 }
136                                         }
137                                 ],
138                                 "networkSecurityGroup": {
139                                         "id": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupsName'))]"
140                                 }
141                         }
142                 },
143                 {
144                         "type": "Microsoft.Compute/virtualMachines",
145                         "apiVersion": "2020-06-01",
146                         "name": "[variables('nicName')]",
147                         "location": "[parameters('location')]",
148                         "dependsOn": [
149                                 "[resourceId('Microsoft.Storage/storageAccounts/', variables('nicNameStr'))]",
150                                 "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicNameNet'))]"
151                         ],
152                         "properties": {
153                                 "hardwareProfile": {
154                                         "vmSize": "Standard_B1ls"
155                                 },
156                                 "osProfile": {
157                                         "computerName": "[variables('nicName')]",
158                                         "adminUsername": "userland",
159                                         "linuxConfiguration": {
160                                                 "disablePasswordAuthentication": true,
161                                                 "ssh": {
162                                                         "publicKeys": [
163                                                                 {
164                                                                         "path": "/home/userland/.ssh/authorized_keys",
165                                                                         "keyData": "--YOUR SSH KEY--"
166                                                                 }
167                                                         ]
168                                                 }
169                                         }
170                                 },
171                                 "storageProfile": {
172                                         "imageReference": {
173                                                 "publisher": "debian",
174                                                 "offer": "debian-11",
175                                                 "sku": "11",
176                                                 "version": "latest"
177                                         },
178                                         "osDisk": {
179                                                 "createOption": "FromImage"
180                                         }
181                                 },
182                                 "networkProfile": {
183                                         "networkInterfaces": [
184                                                 {
185                                                         "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicNameNet'))]",
186                                                         "properties": {
187                                                                 "deleteOption": "Delete"
188                                                         }
189                                                 }
190                                         ]
191                                 },
192                                 "diagnosticsProfile": {
193                                         "bootDiagnostics": {
194                                                 "enabled": true,
195                                                 "storageUri": "[reference(variables('nicNameStr'),'2015-06-15').primaryEndpoints['blob']]"
196                                         }
197                                 }
198                         },
199                         "identity": {
200                                 "type": "systemAssigned"
201                         }
202                 }
203         ]
204 }
205 ```
206
207 ##### To create VMs:
208 Replace REGION=... with your sorted available regions list
209 NOTE: You will have to change `index.js:const clients` to the number of regions you have
210 ```sh
211 ID=$(az ts show --name --MY TEMPLATE NAME-- --resource-group --MY RESOURCE GROUP--  --version "--MY VERSION--" --query "id")
212 REGION="eastus eastus2 westus2 westus3"
213 for i in $REGION; do az deployment group create   --resource-group --MY RESOURCE GROUP--   --template-spec $ID --parameters "{ \"location\": {\"value\": \"$i\"}}" ; done
214 ```
215
216 ##### To start VMs:
217 You will need to create a storage account and create a share and copy the ssh-rsa key and username to .
218
219 ```sh
220 echo '#!/bin/bash' > install.sh
221 echo 'echo "username=--STORE ACC NAME--" >> /etc/smb.cred' >> install.sh
222 echo 'echo "password=--STORE SSH-RSA KEY--" >> /etc/smb.cred' >> install.sh
223 curl https://raw.githubusercontent.com/Mr-Bossman/dist-masscan/master/install.sh >> install.sh
224 VMS=$(az vm list -d -g temp --query "[].name" -o tsv)
225 for i in $VMS; do az vm run-command invoke -g temp -n $i --command-id RunShellScript --scripts @install.sh; done
226 ```
227
228 ##### To list VMs IPs
229 ```sh
230 az vm list -d -g temp --query "[].publicIps" -o tsv
231 ```
This page took 0.037861 seconds and 4 git commands to generate.