Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on first run #40

Open
dellarte opened this issue Nov 28, 2019 · 16 comments
Open

Error on first run #40

dellarte opened this issue Nov 28, 2019 · 16 comments

Comments

@dellarte
Copy link

Hi,

I ran make build withour any error.
Then i tested make start and got this error :

docker run --name flan_1574936755 -v /tmp/flan/shared:/shared flan_scan
mkdir: can't create directory '/shared/xml_files/2019.11.28-10.25': No such file or directory
/run.sh: line 34: can't open /shared/ips.txt: no such file
Traceback (most recent call last):
  File "/output_report.py", line 238, in <module>
    main()
  File "/output_report.py", line 224, in main
    for i, filename in enumerate(os.listdir(dirname)):
FileNotFoundError: [Errno 2] No such file or directory: '/shared/xml_files/2019.11.28-10.25'
sed: /shared/reports/report_2019.11.28-10.25.tex: No such file or directory
sed: /shared/reports/report_2019.11.28-10.25.tex: No such file or directory
sed: /shared/reports/report_2019.11.28-10.25.tex: No such file or directory
sed: /shared/reports/report_2019.11.28-10.25.tex: No such file or directory
@root360-AndreasUlm
Copy link

Did you use the folder structure provided by 'shared'-folder in the git to initialize your '/tmp/flan/shared'?

If not than that's the reason because the run logic currently expects that the shared folder has the following content:

  • ips.txt (= list of IPs to be scanned)
  • xml_files/ (= folder to store nmap scan results)
  • reports/ (= folder to store latex reports)

@dellarte
Copy link
Author

I scrupulously followed all the steps :

  • Cloned this repo in /tmp
  • get in the /tmp/flan folder
  • Inserted one IP address in /tmp/flan/shared/ips.txt
  • executed make build (everything's working)
  • executed make start

I'm on Windows, using WSL
My docker version is Docker version 19.03.2, build 6a30dfc

@adi928
Copy link

adi928 commented Nov 29, 2019

As @root360-AndreasUlm mentioned, you may have to create the folders 'xm_files' and 'reports' beforehand in your shared folder.

@Zebradil
Copy link

I have the same error. I'll go check the Makefile to see how to fix it and it's not a big deal, probably.
What I'm concerned about is the instructions in README. There is nothing said about directory creation or something like this:

image

@Zebradil
Copy link

Hmm, it seems like the issue is not the same. The output is slightly different:

Read data files from: /usr/bin/../share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Mon Dec  9 16:26:01 2019 -- 256 IP addresses (6 hosts up) scanned in 5472.80 seconds
Traceback (most recent call last):
  File "/output_report.py", line 238, in <module>
    main()
  File "/output_report.py", line 229, in main
    parse_results(data)
  File "/output_report.py", line 113, in parse_results
    parse_host(h)
  File "/output_report.py", line 102, in parse_host
    parse_port(ip_addr, p)
  File "/output_report.py", line 86, in parse_port
    parse_script(ip_addr, port_num, app_name, scripts)
  File "/output_report.py", line 36, in parse_script
    script_table = script['table']['table']
TypeError: list indices must be integers or slices, not str
sed: /shared/reports/report_2019.12.09-14.54.tex: No such file or directory
sed: /shared/reports/report_2019.12.09-14.54.tex: No such file or directory
sed: /shared/reports/report_2019.12.09-14.54.tex: No such file or directory
sed: /shared/reports/report_2019.12.09-14.54.tex: No such file or directory

@dellarte
Copy link
Author

dellarte commented Jan 2, 2020

There is no directory to create since they are present when this repo is cloned.
The issue is still here :

root@mylaptop:/tmp/flan# ls -l
total 28
-rw-r--r-- 1 root root  411 Jan  2 10:36 Dockerfile
-rw-r--r-- 1 root root 1518 Jan  2 10:36 LICENSE
-rw-r--r-- 1 root root  172 Jan  2 10:36 Makefile
-rw-r--r-- 1 root root 5262 Jan  2 10:36 README.md
-rw-r--r-- 1 root root  287 Jan  2 10:36 aws_push.py
-rw-r--r-- 1 root root  214 Jan  2 10:36 gcp_push.py
drwxr-xr-x 1 root root 4096 Jan  2 10:36 kubernetes_templates
-rw-r--r-- 1 root root  397 Jan  2 10:36 latex_header.tex
-rw-r--r-- 1 root root 8488 Jan  2 10:36 output_report.py
-rwxr-xr-x 1 root root 1046 Jan  2 10:36 run.sh
drwxr-xr-x 1 root root 4096 Jan  2 10:40 shared
root@mylaptop:/tmp/flan# ls -l shared/
total 0
-rw-r--r-- 1 root root   15 Jan  2 10:37 ips.txt
drwxr-xr-x 1 root root 4096 Jan  2 10:36 reports
drwxr-xr-x 1 root root 4096 Jan  2 10:36 xml_files

@dellarte
Copy link
Author

dellarte commented Jan 2, 2020

There is no directory to create since they are present when this repo is cloned.
The issue is still here :

root@mylaptop:/tmp/flan# ls -l
total 28
-rw-r--r-- 1 root root  411 Jan  2 10:36 Dockerfile
-rw-r--r-- 1 root root 1518 Jan  2 10:36 LICENSE
-rw-r--r-- 1 root root  172 Jan  2 10:36 Makefile
-rw-r--r-- 1 root root 5262 Jan  2 10:36 README.md
-rw-r--r-- 1 root root  287 Jan  2 10:36 aws_push.py
-rw-r--r-- 1 root root  214 Jan  2 10:36 gcp_push.py
drwxr-xr-x 1 root root 4096 Jan  2 10:36 kubernetes_templates
-rw-r--r-- 1 root root  397 Jan  2 10:36 latex_header.tex
-rw-r--r-- 1 root root 8488 Jan  2 10:36 output_report.py
-rwxr-xr-x 1 root root 1046 Jan  2 10:36 run.sh
drwxr-xr-x 1 root root 4096 Jan  2 10:40 shared
root@mylaptop:/tmp/flan# ls -l shared/
total 0
-rw-r--r-- 1 root root   15 Jan  2 10:37 ips.txt
drwxr-xr-x 1 root root 4096 Jan  2 10:36 reports
drwxr-xr-x 1 root root 4096 Jan  2 10:36 xml_files

It seems it's a docker issue on windows.
Volumes are not mount.. Working on it.

@Powelljl
Copy link

Powelljl commented Mar 8, 2020

I'm having the same issue on my Ubuntu VM,

docker run --name flan_1583706873 -v "/shared:/shared:Z" flan_scan mkdir: can't create directory '/shared/xml_files/2020.03.08-22.34': No such file or directory /run.sh: line 34: can't open /shared/ips.txt: no such file Traceback (most recent call last): File "/output_report.py", line 72, in <module> main(*sys.argv[1:4], report_type='latex') File "/output_report.py", line 59, in main for entry in os.scandir(dirname): # type: os.DirEntry FileNotFoundError: [Errno 2] No such file or directory: '/shared/xml_files/2020.03.08-22.34' sed: /shared/reports/report_2020.03.08-22.34.tex: No such file or directory sed: /shared/reports/report_2020.03.08-22.34.tex: No such file or directory sed: /shared/reports/report_2020.03.08-22.34.tex: No such file or directory sed: /shared/reports/report_2020.03.08-22.34.tex: No such file or directory

It seems to output fine for me with docker build and docker run flan_scan, but don't get the output reports.

@ghost
Copy link

ghost commented Mar 9, 2020

Can confirm the same issue exists on a vanilla debian 10 installation. Error on first attempt of make start. All dirs exist like they should.

root@flan:/home/jb/flan/shared# ls -lart total 36 drwxr-xr-x 2 jb jb 4096 Mar 9 11:54 xml_files drwxr-xr-x 2 jb jb 4096 Mar 9 11:54 reports drwxr-xr-x 6 jb jb 4096 Mar 9 11:54 .. -rw-r--r-- 1 jb jb 18149 Mar 9 12:01 ips.txt drwxr-xr-x 4 jb jb 4096 Mar 9 12:01 .

root@flan:/home/jb/flan# make start docker run --name flan_1583755701 -v "/shared:/shared:Z" flan_scan mkdir: can't create directory '/shared/xml_files/2020.03.09-12.08': No such file or directory /run.sh: line 34: can't open /shared/ips.txt: no such file Traceback (most recent call last): File "/output_report.py", line 72, in <module> main(*sys.argv[1:4], report_type='latex') File "/output_report.py", line 59, in main for entry in os.scandir(dirname): # type: os.DirEntry FileNotFoundError: [Errno 2] No such file or directory: '/shared/xml_files/2020.03.09-12.08' sed: /shared/reports/report_2020.03.09-12.08.tex: No such file or directory sed: /shared/reports/report_2020.03.09-12.08.tex: No such file or directory sed: /shared/reports/report_2020.03.09-12.08.tex: No such file or directory sed: /shared/reports/report_2020.03.09-12.08.tex: No such file or directory

@nadinelyab
Copy link
Contributor

Hey @jboger and @Powelljl,
I just merged a PR that might fix this. Can you try again?

@Powelljl
Copy link

Hey @nadinelyab

Sorry for the delay, yep all working now :).

@ILPlais
Copy link

ILPlais commented May 13, 2021

Hello,
I just clone the last repository (5b92766), so with the #54 merge from @nadinelyab. But I still have the directories' error.

lionel@lionel-X202E:~/Git/flan$ make start
docker run --rm --cap-drop=all --cap-add=NET_RAW --name flan_1620928724 -v "/home/lionel/Git/flan/shared:/shared:Z" flan_scan
mkdir: can't create directory '/shared/xml_files/2021.05.13-17.58': Permission denied
Failed to open XML output file /shared/xml_files/2021.05.13-17.58/1.1.1.1.xml for writing
QUITTING!
[…]
Traceback (most recent call last):
  File "/output_report.py", line 81, in <module>
    main(*sys.argv[1:4], report_type=report_format)
  File "/output_report.py", line 67, in main
    for entry in os.scandir(dirname):  # type: os.DirEntry
FileNotFoundError: [Errno 2] No such file or directory: '/shared/xml_files/2021.05.13-17.58'
sed: /shared/reports/report_2021.05.13-17.58.tex: No such file or directory
sed: /shared/reports/report_2021.05.13-17.58.tex: No such file or directory
sed: /shared/reports/report_2021.05.13-17.58.tex: No such file or directory
sed: /shared/reports/report_2021.05.13-17.58.tex: No such file or directory

For information, I have two warnings with make build:

WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv
Cloning into '/usr/share/nmap/scripts/vulners'...

And

WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: No such file or directory
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: No such file or directory

Someone has the same issue and how to fix it?
Thanks.

@g33k247
Copy link

g33k247 commented Jun 11, 2021

I discovered that the xml_files folder had incorrect perms for "others". Once I corrected that issue, flan works great!

@sebelk
Copy link

sebelk commented Jun 23, 2021

I've found that chmoding with 777 and directories under shared it works, is that the expected behaviour?

@AlanKK
Copy link

AlanKK commented Oct 16, 2021

I just had the same issue and chmoding with 777 fixed it for me too.

@NouvelleEcosse
Copy link

Following all instructions, I had similar permissions errors as those mentioned in this thread. I tried doing a chmod -R 777 on the shared directory and that fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests