odedshimon / BruteShark

Network Analysis Tool
GNU General Public License v3.0
3.04k stars 332 forks source link

Export of NetworkMap Failes #75

Closed cgoat closed 3 years ago

cgoat commented 3 years ago

I get the following message when i try to export the networkmap

Error: Access to the path '/home/xxx/dump/NetworkMap/networkmap.json' is denied.

Command run is ./BruteSharkCli -m NetworkMap -i /home/xxx/dump/server.tcpdump -o /home/vbandaru/dump/ Result [+] Started analyzing 1 files File : server.tcpdump Processing Started File : server.tcpdump Processing Finished Error: Access to the path '/home/xxx/dump/NetworkMap/networkmap.json' is denied.

odedshimon commented 3 years ago

Hi @cgoat, It seems that you dont have write permisions to the directory. You can run bruteshark with proper permissions (e.g root) or change the directory permissions. Please let me know if that helped you. Oded

cgoat commented 3 years ago

Hi Oded, Thanks for your prompt response. Yes. I have run it as root and also with my account. This is running on my Laptop where i have full permissions. I have noticed that it is trying to create a file network.json under the NetworkMap folder. However when i do an ls under the NetworkMap folder i see a directory called network.json, not a file.

Also i tried to create a empty file (network.json) under the NetworkMap folder and tried to run the script. I get the message ".....networkmap.json' already exists."

I am running it on Ubuntu 20.x

odedshimon commented 3 years ago

Thank you I will fix it this week.

cgoat commented 3 years ago

Thank you !!

ravening commented 3 years ago

I'm getting the same error as well. Running on Ubuntu as root and has given 777 permission to the folder but it tries to create a new folder and then fails

Brute-Shark > export-networkmap /tmp/networkmap/test.json
Unhandled exception. System.UnauthorizedAccessException: Access to the path '/tmp/networkmap/test.json/NetworkMap/networkmap.json' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at System.IO.File.WriteAllText(String path, String contents)
   at PcapAnalyzer.NetwrokMapJsonExporter.FileExport(List`1 connections, String filePath)
   at BruteSharkCli.Utilities.ExportNetworkMap(String dirPath, HashSet`1 connections)
   at BruteSharkCli.CliShell.<.ctor>b__17_11(String p)
   at BruteSharkCli.CliShell.RunCommand(String userInput)
   at BruteSharkCli.CliShell.HandleUserInput()
   at BruteSharkCli.CliShell.Start()
   at BruteSharkCli.BruteSharkCli.RunShellMode()
   at BruteSharkCli.BruteSharkCli.Start()
   at BruteSharkCli.Program.Main(String[] args)
Aborted

drwxrwxrwx   3 root  root      4096 Jan 25 15:10 networkmap
odedshimon commented 3 years ago

@ravening, @cgoat Please check the new version: https://github.com/odedshimon/BruteShark/releases/tag/v1.1.6 I will appreciate if you let me know if that solve the problem. Oded

cgoat commented 3 years ago

Works for me on Ubuntu. Thank you !!