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