tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
networkminer: 2.8 -> 3.0
gepbird.tngl.sh
8 months ago
e1443bd5
d6906498
verified
This commit was signed with the committer's
known signature
.
gepbird.tngl.sh
SSH Key Fingerprint:
SHA256:MP2UpIRtJpbFFqyucP431H/FPCfn58UhEUTro4lXtRs=
+15
-197
3 changed files
expand all
collapse all
unified
split
pkgs
by-name
ne
networkminer
deps.json
package.nix
xdg-dirs.patch
+2
-7
pkgs/by-name/ne/networkminer/deps.json
···
5
5
"hash": "sha256-FBoJP5DHZF0QHM0xLm9yd4HJZVQOuSpSKA+VQRpphEE="
6
6
},
7
7
{
8
8
-
"pname": "Microsoft.NETFramework.ReferenceAssemblies.net461",
8
8
+
"pname": "Microsoft.NETFramework.ReferenceAssemblies.net48",
9
9
"version": "1.0.3",
10
10
-
"hash": "sha256-vVIonl+4dlCQuxibOZoGR3o1DAhjAYpFW15dnkUpjMk="
11
11
-
},
12
12
-
{
13
13
-
"pname": "Microsoft.NETFramework.ReferenceAssemblies.net472",
14
14
-
"version": "1.0.3",
15
15
-
"hash": "sha256-/6ClVwo5+RE5kWTQWB/93vmbXj37ql8iDlziKWm89Xw="
10
10
+
"hash": "sha256-in40hTjn65E1FpaRFon0nj1PY/i6tRdDK74Vm4sRBKI="
16
11
}
17
12
]
+13
-16
pkgs/by-name/ne/networkminer/package.nix
···
10
10
}:
11
11
buildDotnetModule rec {
12
12
pname = "networkminer";
13
13
-
version = "2.8";
13
13
+
version = "3.0";
14
14
15
15
-
src = fetchurl {
16
16
-
# Upstream does not provide versioned releases, a mirror has been uploaded
17
17
-
# to archive.org
18
18
-
url = "https://archive.org/download/networkminer-${
19
19
-
lib.replaceStrings [ "." ] [ "-" ] version
20
20
-
}/NetworkMiner_${lib.replaceStrings [ "." ] [ "-" ] version}_source.zip";
21
21
-
sha256 = "1n2312acq5rq0jizlcfk0crslx3wgcsd836p47nk3pnapzw0cqvv";
22
22
-
};
15
15
+
src =
16
16
+
let
17
17
+
version' = lib.replaceString "." "-" version;
18
18
+
in
19
19
+
fetchurl {
20
20
+
# Upstream does not provide versioned releases, a mirror has been uploaded
21
21
+
# to archive.org
22
22
+
# Non-versioned download link can be found on https://www.netresec.com/?page=NetworkMinerSourceCode
23
23
+
url = "https://archive.org/download/network-miner-${version'}-source/NetworkMiner_${version'}_source.zip";
24
24
+
hash = "sha256-I5VtpfmlYO0+K1WtwouP0lzJptpE0sHn5JeCBTnXdio=";
25
25
+
};
23
26
24
27
dotnet-sdk = dotnetCorePackages.sdk_8_0;
25
28
···
27
30
unzip
28
31
dos2unix
29
32
msbuild
30
30
-
];
31
31
-
32
32
-
patches = [
33
33
-
# Store application data in XDG_DATA_DIRS instead of trying to write to nix store
34
34
-
./xdg-dirs.patch
35
33
];
36
34
37
35
postPatch = ''
···
64
62
65
63
install -D NetworkMiner/NetworkMiner.desktop $out/share/applications/NetworkMiner.desktop
66
64
substituteInPlace $out/share/applications/NetworkMiner.desktop \
67
67
-
--replace "Exec=mono NetworkMiner.exe %f" "Exec=NetworkMiner" \
68
68
-
--replace "Icon=./networkminericon-96x96.png" "Icon=NetworkMiner"
65
65
+
--replace-fail "Icon=./Images/NetworkMiner_logo_313x313.png" "Icon=NetworkMiner"
69
66
install -D NetworkMiner/networkminericon-96x96.png $out/share/pixmaps/NetworkMiner.png
70
67
71
68
runHook postInstall
-174
pkgs/by-name/ne/networkminer/xdg-dirs.patch
···
1
1
-
diff --git a/NetworkMiner/NetworkMinerForm.cs b/NetworkMiner/NetworkMinerForm.cs
2
2
-
index 06c808b..6495b73 100644
3
3
-
--- a/NetworkMiner/NetworkMinerForm.cs
4
4
-
+++ b/NetworkMiner/NetworkMinerForm.cs
5
5
-
@@ -1,4 +1,4 @@
6
6
-
-// Copyright: Erik Hjelmvik, NETRESEC
7
7
-
+// Copyright: Erik Hjelmvik, NETRESEC
8
8
-
//
9
9
-
// NetworkMiner is free software; you can redistribute it and/or modify it
10
10
-
// under the terms of the GNU General Public License
11
11
-
@@ -419,7 +419,7 @@ namespace NetworkMiner {
12
12
-
}
13
13
-
try {
14
14
-
//require FileIOPermission to be PermissionState.Unrestricted
15
15
-
- string path = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY;
16
16
-
+ string path = System.IO.Path.GetDirectoryName(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome()) + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY;
17
17
-
System.Security.Permissions.FileIOPermission fileIOPerm = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.AllAccess, path);
18
18
-
fileIOPerm.Demand();
19
19
-
}
20
20
-
@@ -1023,13 +1023,13 @@ namespace NetworkMiner {
21
21
-
public void CreateNewPacketHandlerWrapper(System.IO.DirectoryInfo outputDirectory) {
22
22
-
//make sure that folders exists
23
23
-
try {
24
24
-
- System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(outputDirectory.FullName + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY);
25
25
-
+ System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY);
26
26
-
if (!di.Exists)
27
27
-
di.Create();
28
28
-
- di = new System.IO.DirectoryInfo(outputDirectory.FullName + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar + "cache");
29
29
-
+ di = new System.IO.DirectoryInfo(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar + "cache");
30
30
-
if (!di.Exists)
31
31
-
di.Create();
32
32
-
- di = new System.IO.DirectoryInfo(outputDirectory.FullName + System.IO.Path.DirectorySeparatorChar + "Captures");
33
33
-
+ di = new System.IO.DirectoryInfo(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + "Captures");
34
34
-
if (!di.Exists)
35
35
-
di.Create();
36
36
-
}
37
37
-
@@ -1962,7 +1962,7 @@ namespace NetworkMiner {
38
38
-
string filename = Tools.GenerateCaptureFileName(DateTime.Now);
39
39
-
//string filename="NM_"+DateTime.Now.ToString("s", System.Globalization.DateTimeFormatInfo.InvariantInfo).Replace(':','-')+".pcap";
40
40
-
41
41
-
- string fileFullPath = this.OutputDirectory.FullName + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
42
42
-
+ string fileFullPath = SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
43
43
-
//string fileFullPath = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(System.Windows.Forms.Application.ExecutablePath)) + System.IO.Path.DirectorySeparatorChar + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
44
44
-
45
45
-
//make sure to get the right datalink type
46
46
-
@@ -2534,7 +2534,7 @@ namespace NetworkMiner {
47
47
-
48
48
-
if (removeCapturedFiles) {
49
49
-
PacketParser.FileTransfer.FileStreamAssemblerList.RemoveTempFiles();
50
50
-
- string capturesDirectory = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(System.Windows.Forms.Application.ExecutablePath)) + System.IO.Path.DirectorySeparatorChar + "Captures";
51
51
-
+ string capturesDirectory = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome())) + System.IO.Path.DirectorySeparatorChar + "Captures";
52
52
-
if (System.IO.Directory.Exists(capturesDirectory)) {
53
53
-
foreach (string pcapFile in System.IO.Directory.GetFiles(capturesDirectory))
54
54
-
try {
55
55
-
@@ -2545,7 +2545,7 @@ namespace NetworkMiner {
56
56
-
//this.ShowAnomaly("Error deleting file \"" + pcapFile + "\"", DateTime.Now);
57
57
-
}
58
58
-
}
59
59
-
- capturesDirectory = this.packetHandlerWrapper.PacketHandler.OutputDirectory + "Captures";
60
60
-
+ capturesDirectory = SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + "Captures";
61
61
-
if (System.IO.Directory.Exists(capturesDirectory)) {
62
62
-
foreach (string pcapFile in System.IO.Directory.GetFiles(capturesDirectory))
63
63
-
try {
64
64
-
@@ -2635,7 +2635,7 @@ namespace NetworkMiner {
65
65
-
try {
66
66
-
PacketParser.Utils.ByteConverter.ToByteArrayFromHexString(keyword);//to force valid hex
67
67
-
this.keywordListBox.Items.Add(keyword);
68
68
-
- //L�gg till keywordet till PacketHandler.PacketHandler!!!
69
69
-
+ //L�gg till keywordet till PacketHandler.PacketHandler!!!
70
70
-
}
71
71
-
catch (Exception ex) {
72
72
-
errorMessage = ex.Message;
73
73
-
@@ -2720,7 +2720,7 @@ namespace NetworkMiner {
74
74
-
#endregion
75
75
-
76
76
-
private void hostSortOrderComboBox_SelectedIndexChanged(object sender, EventArgs e) {
77
77
-
- //H�R SKA detailsHeader LIGGA Enabled MASSA OLIKA SORTERINGSORDNINGAR:
78
78
-
+ //H�R SKA detailsHeader LIGGA Enabled MASSA OLIKA SORTERINGSORDNINGAR:
79
79
-
//IP, HOTSNAME, SENT PACKETS, RECEIVED PACKETS, MAC ADDRESS
80
80
-
this.RebuildHostsTree(sender, e);
81
81
-
}
82
82
-
@@ -2754,7 +2754,7 @@ namespace NetworkMiner {
83
83
-
foreach (string p in paths) {
84
84
-
if (!p.Contains(PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY))
85
85
-
return false;
86
86
-
- if (!this.IsSubDirectoryOf(new System.IO.DirectoryInfo(p), new System.IO.DirectoryInfo(this.packetHandlerWrapper.PacketHandler.OutputDirectory + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY)))
87
87
-
+ if (!this.IsSubDirectoryOf(new System.IO.DirectoryInfo(p), new System.IO.DirectoryInfo(SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY)))
88
88
-
return false;
89
89
-
}
90
90
-
return true;
91
91
-
@@ -3976,7 +3976,7 @@ finally {
92
92
-
}
93
93
-
94
94
-
private void closeToolStripMenuItem_Click(object sender, EventArgs e) {
95
95
-
- DialogResult yesOrNo = MessageBox.Show("Would you like to delete all extracted files from:" + Environment.NewLine + this.OutputDirectory.FullName + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar, "Delete extracted files?", MessageBoxButtons.YesNo);
96
96
-
+ DialogResult yesOrNo = MessageBox.Show("Would you like to delete all extracted files from:" + Environment.NewLine + SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar, "Delete extracted files?", MessageBoxButtons.YesNo);
97
97
-
this.ResetCapturedData(false, yesOrNo == DialogResult.Yes, true);
98
98
-
}
99
99
-
100
100
-
diff --git a/NetworkMiner/PcapOverIP/ReceivePcapOverTcpForm.cs b/NetworkMiner/PcapOverIP/ReceivePcapOverTcpForm.cs
101
101
-
index 9bae5f0..72586d4 100644
102
102
-
--- a/NetworkMiner/PcapOverIP/ReceivePcapOverTcpForm.cs
103
103
-
+++ b/NetworkMiner/PcapOverIP/ReceivePcapOverTcpForm.cs
104
104
-
@@ -162,7 +162,7 @@ namespace NetworkMiner.PcapOverIP {
105
105
-
DateTime lastFrameTimestamp = DateTime.MinValue;
106
106
-
107
107
-
string filename = Tools.GenerateCaptureFileName(DateTime.Now);
108
108
-
- string fileFullPath = this.packetHandler.OutputDirectory + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
109
109
-
+ string fileFullPath = SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
110
110
-
//string fileFullPath = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(System.Windows.Forms.Application.ExecutablePath)) + System.IO.Path.DirectorySeparatorChar + "Captures" + System.IO.Path.DirectorySeparatorChar + filename;
111
111
-
112
112
-
PcapFileWriter pcapFileWriter = new PcapFileWriter(fileFullPath, this.pcapStreamReader.FileDataLinkType[0]);
113
113
-
diff --git a/PacketParser/FileTransfer/FileStreamAssemblerList.cs b/PacketParser/FileTransfer/FileStreamAssemblerList.cs
114
114
-
index 4a6a4dd..129d48b 100644
115
115
-
--- a/PacketParser/FileTransfer/FileStreamAssemblerList.cs
116
116
-
+++ b/PacketParser/FileTransfer/FileStreamAssemblerList.cs
117
117
-
@@ -191,7 +191,7 @@ namespace PacketParser.FileTransfer {
118
118
-
if (removeExtractedFilesFromDisk) {
119
119
-
//remove all files
120
120
-
foreach (string subDirectory in System.IO.Directory.GetDirectories(this.FileOutputDirectory)) {
121
121
-
- if (subDirectory == this.FileOutputDirectory + System.IO.Path.DirectorySeparatorChar + "cache") {
122
122
-
+ if (subDirectory == SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + "cache") {
123
123
-
foreach (string cacheFile in System.IO.Directory.GetFiles(subDirectory))
124
124
-
try {
125
125
-
System.IO.File.Delete(cacheFile);
126
126
-
diff --git a/PacketParser/PacketHandler.cs b/PacketParser/PacketHandler.cs
127
127
-
index a600200..cb78071 100644
128
128
-
--- a/PacketParser/PacketHandler.cs
129
129
-
+++ b/PacketParser/PacketHandler.cs
130
130
-
@@ -1,4 +1,4 @@
131
131
-
-// Copyright: Erik Hjelmvik, NETRESEC
132
132
-
+// Copyright: Erik Hjelmvik, NETRESEC
133
133
-
//
134
134
-
// NetworkMiner is free software; you can redistribute it and/or modify it
135
135
-
// under the terms of the GNU General Public License
136
136
-
@@ -228,7 +228,7 @@ namespace PacketParser {
137
137
-
//this.networkTcpSessionDictionary=new Dictionary<int, NetworkTcpSession>();
138
138
-
this.networkTcpSessionList=new PopularityList<int, NetworkTcpSession>(200);
139
139
-
this.networkTcpSessionList.PopularityLost+=new PopularityList<int, NetworkTcpSession>.PopularityLostEventHandler(networkTcpSessionList_PopularityLost);
140
140
-
- this.FileStreamAssemblerList = new FileTransfer.FileStreamAssemblerList(this, 100, this.OutputDirectory + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar);
141
141
-
+ this.FileStreamAssemblerList = new FileTransfer.FileStreamAssemblerList(this, 100, SharedUtils.XdgDirectories.GetOrCreateXdgDataHome() + System.IO.Path.DirectorySeparatorChar + PacketParser.FileTransfer.FileStreamAssembler.ASSMEBLED_FILES_DIRECTORY + System.IO.Path.DirectorySeparatorChar);
142
142
-
this.FileStreamAssemblerList.PopularityLost += this.FileStreamAssemblerList_PopularityLost;
143
143
-
this.ReconstructedFileList=new List<FileTransfer.ReconstructedFile>();
144
144
-
this.credentialList=new SortedList<string, NetworkCredential>();
145
145
-
@@ -874,7 +874,7 @@ namespace PacketParser {
146
146
-
147
147
-
//check the frame content for keywords
148
148
-
foreach (byte[] keyword in this.keywordList) {
149
149
-
- //jAG SLUTADE H�R. FUNKAR EJ VID RELOAD
150
150
-
+ //jAG SLUTADE H�R. FUNKAR EJ VID RELOAD
151
151
-
int keyIndex = receivedFrame.IndexOf(keyword);
152
152
-
if (keyIndex >= 0) {
153
153
-
if (networkPacket != null)
154
154
-
diff --git a/SharedUtils/XdgDirectories.cs b/SharedUtils/XdgDirectories.cs
155
155
-
new file mode 100644
156
156
-
index 0000000..80c09e3
157
157
-
--- /dev/null
158
158
-
+++ b/SharedUtils/XdgDirectories.cs
159
159
-
@@ -0,0 +1,15 @@
160
160
-
+using System;
161
161
-
+using System.IO;
162
162
-
+
163
163
-
+namespace SharedUtils {
164
164
-
+ public class XdgDirectories {
165
165
-
+ public static string GetOrCreateXdgDataHome() {
166
166
-
+ string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
167
167
-
+ string data = Environment.GetEnvironmentVariable("XDG_DATA_HOME") ?? home + System.IO.Path.DirectorySeparatorChar + ".local" + System.IO.Path.DirectorySeparatorChar + "share";
168
168
-
+ string dir = data + System.IO.Path.DirectorySeparatorChar + "NetworkMiner";
169
169
-
+ // Directory.CreateDirectory(dir);
170
170
-
+ return dir;
171
171
-
+ }
172
172
-
+
173
173
-
+ }
174
174
-
+}