Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit 15b6bd2

Browse files
committed
Updates
1 parent 83a253f commit 15b6bd2

File tree

7 files changed

+65
-7
lines changed

7 files changed

+65
-7
lines changed

CHANGELOG.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
LEGION 0.4.3
2+
3+
* Revise NMAP import process
4+
* Fix import progress calculations
5+
* Doubleckick to copy hostname (Linux only)
6+
* Script to generate huge bogus NMAP XML imports for testing.
7+
18
LEGION 0.4.2
29

310
* Tweak the screenshooter to use eyewitness as suggested by daniruiz

app/ApplicationInfo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
applicationInfo = {
2020
"name": "LEGION",
21-
"version": "0.4.2",
22-
"build": '1700525714',
21+
"version": "0.4.3",
22+
"build": '1700529501',
2323
"author": "Gotham Security",
2424
"copyright": "2023",
2525
"links": ["http://github.com/GoVanguard/legion/issues", "https://gotham-security.com/legion"],

buildHugeNmapTest.py

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import xml.etree.ElementTree as ET
2-
from random import randint, choice, sample
2+
from random import randint, choice, choices, sample
33
import datetime
44

55
def generate_nmap_xml(num_hosts=1000, base_subnet="172.16"):
@@ -62,20 +62,49 @@ def generate_nmap_xml(num_hosts=1000, base_subnet="172.16"):
6262
"afp": {"product": "Netatalk AFP", "version": "3.1.12"}
6363
}
6464

65+
# Expanded lists for generating hostnames
66+
colors = ["Red", "Blue", "Green", "Yellow", "Purple", "Orange", "Cyan", "Magenta", "Lime", "Pink"]
67+
foods = ["Apple", "Burger", "Cake", "Dumpling", "Eclair", "Pizza", "Sushi", "Taco", "Waffle", "Bagel"]
68+
cities = ["Tokyo", "Paris", "London", "NewYork", "Sydney", "Berlin", "Rome", "Madrid", "Moscow", "Beijing"]
69+
verbs = ["Jumping", "Running", "Flying", "Swimming", "Dancing", "Singing", "Playing", "Walking", "Reading", "Writing"]
70+
71+
# Unique hostname tracker
72+
generated_hostnames = set()
73+
74+
# Function to create unique random hostnames
75+
def generate_hostname():
76+
while True:
77+
parts = [choice(colors), choice(foods), choice(cities), choice(verbs)]
78+
hostname = '.'.join(parts)
79+
# Ensure uniqueness by appending a number if needed
80+
if hostname not in generated_hostnames:
81+
generated_hostnames.add(hostname)
82+
return hostname
83+
else:
84+
hostname += str(randint(0, 9999))
85+
if hostname not in generated_hostnames:
86+
generated_hostnames.add(hostname)
87+
return hostname
88+
6589
# Function to create a random IP address within the extended subnet range
6690
def random_ip(base_subnet, host_number):
6791
subnet_third_octet = host_number // 254
6892
host_fourth_octet = host_number % 254 + 1
6993
return f"{base_subnet}.{subnet_third_octet}.{host_fourth_octet}"
7094

71-
# Generating hosts with updated IP address method
95+
# Generating hosts with updated IP address and hostname method
7296
for i in range(num_hosts):
7397
host_os = choice(list(os_services.keys()))
7498

7599
host = ET.Element("host")
76100
ET.SubElement(host, "status", {"state": "up", "reason": "arp-response", "reason_ttl": "0"})
77101
ET.SubElement(host, "address", {"addr": random_ip(base_subnet, i), "addrtype": "ipv4"})
78-
ET.SubElement(host, "hostnames")
102+
103+
# Hostnames
104+
hostnames = ET.SubElement(host, "hostnames")
105+
num_hostnames = randint(1, 3) # Random number of hostnames per host
106+
for _ in range(num_hostnames):
107+
ET.SubElement(hostnames, "hostname", {"name": generate_hostname(), "type": "user"})
79108

80109
# Ports
81110
ports = ET.SubElement(host, "ports")
@@ -135,7 +164,7 @@ def random_ip(base_subnet, host_number):
135164
xml_str = xml_header + '\n' + ET.tostring(nmaprun, encoding='unicode', method='xml')
136165
return xml_str
137166

138-
def save_nmap_xml(filename, num_hosts=1000, base_subnet="172.16"):
167+
def save_nmap_xml(filename, num_hosts=200, base_subnet="172.16"):
139168
# Generate the XML content
140169
xml_content = generate_nmap_xml(num_hosts, base_subnet)
141170

controller/controller.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ def closeProject(self):
236236
self.view.updateProcessesTableView() # clear process table
237237
self.logic.projectManager.closeProject(self.logic.activeProject)
238238

239+
def copyToClipboard(self, data):
240+
clipboard = QtWidgets.QApplication.clipboard()
241+
clipboard.setText(data) # Assuming item.text() contains the IP or hostname
239242

240243
@timing
241244
def addHosts(self, targetHosts, runHostDiscovery, runStagedNmap, nmapSpeed, scanMode, nmapOptions = []):

debian/changelog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ legion (0.4.2-0) UNRELEASED; urgency=medium
3232
* Fix typo in startLegion.sh
3333

3434
-- Shane Scott <sscot@gotham-security.com> Mon, 20 Nov 2023 12:50:55 -0600
35+
36+
legion (0.4.3-0) UNRELEASED; urgency=medium
37+
38+
* Revise NMAP import process
39+
* Fix import progress calculations
40+
* Doubleckick to copy hostname (Linux only)
41+
* Script to generate huge bogus NMAP XML imports for testing.
42+
43+
-- Shane Scott <sscott@gotham-security.com> Mon, 20 Nov 2023 19:17:00 -0600

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Priority: optional
44
Maintainer: GoVanguard <hello@gotham-security.com>
55
Uploaders: Shane Scott <sscott@gotham-security.com>
66
Build-Depends: debhelper, python3, python3-requests
7-
Standards-Version: 0.4.2
7+
Standards-Version: 0.4.3
88
Homepage: https://github.com/GoVanguard/Legion
99

1010
Package: legion

ui/view.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def initTables(self): # this function prepares the default settings for each ta
192192
self.HostsTableModel.sort(3, Qt.SortOrder.DescendingOrder)
193193
# Connect the clicked signal of the HostsTableView to the hostTableClick() method
194194
self.ui.HostsTableView.clicked.connect(self.hostTableClick)
195+
self.ui.HostsTableView.doubleClicked.connect(self.hostTableDoubleClick)
195196

196197
##
197198

@@ -580,6 +581,15 @@ def hostTableClick(self):
580581

581582
def connectServiceNamesTableClick(self):
582583
self.ui.ServiceNamesTableView.clicked.connect(self.serviceNamesTableClick)
584+
585+
def hostTableDoubleClick(self, index):
586+
# Get the item from the model using the index
587+
model = self.ui.HostsTableView.model()
588+
row = index.row()
589+
new_index = model.index(row, 3)
590+
data = model.data(new_index, QtCore.Qt.ItemDataRole.DisplayRole)
591+
if data:
592+
self.controller.copyToClipboard(data)
583593

584594
def serviceNamesTableClick(self):
585595
if self.ui.ServiceNamesTableView.selectionModel().selectedRows():

0 commit comments

Comments
 (0)