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

mount custom files on docker #289

Open
supremepot opened this issue Aug 10, 2021 · 9 comments
Open

mount custom files on docker #289

supremepot opened this issue Aug 10, 2021 · 9 comments
Assignees
Labels

Comments

@supremepot
Copy link
Contributor

I can't mount my custom ip range file on docker, how can I do?

@Ullaakut
Copy link
Owner

Hi @supremepot!

Thanks for opening this issue. First, what did you try? What error(s) do you get? The documentation of the repository is pretty straight-forward on that subject:

"-t, --targets": Set target. Required. Target can be a file (see instructions on how to format the file), an IP, an IP range, a subnetwork, or a combination of those. Example: --targets="192.168.1.72,192.168.1.74"

If the issue is that you do not know how to mount files in Docker, this is not the right place to ask, but one of the ways is by using the -v parameter, as shown in an example in the documentation as well:

Running cameradar on a subnetwork with custom dictionaries, on ports 554, 5554 and 8554:

docker run -v /tmp:/tmp --net=host -t ullaakut/cameradar -t 192.168.0.0/24 --custom-credentials="/tmp/dictionaries/credentials.json" --custom-routes="/tmp/dictionaries/routes" -p 554,5554,8554

Instead of mounting a custom dictionary however, you'd need to mount your target file.

Does that make sense?

@Ullaakut Ullaakut self-assigned this Aug 11, 2021
@supremepot
Copy link
Contributor Author

yeah I've tried with the -v parameter, but I get this :

unable to load credentials dictionary: could not read credentials dictionary file at "/tmp/dictionaries/credentials.json": open /tmp/dictionaries/credentials.json: no such file or directory

I've tried too to open the directory, but I found nothing, and the same happens with the custom target list

i have macOs, maybe there Is a different "procedure" to do it?

@Ullaakut
Copy link
Owner

But what you want isn't to load a crendentials dictionary. Also if you don't have a file in /tmp/dictionaries/credentials.json of course it won't be able to mount it. You need to have the file you want to mount, on your filesystem, and to provide the path to your file.

It works just the same on MacOS as on Linux, so no worries that is not the issue.

@supremepot
Copy link
Contributor Author

ok, so the fact is that i can't find the path

@supremepot
Copy link
Contributor Author

I tried installing ubuntu for view the path of /tmp , but even with the path access, and the file loaded I get this error:
unable to split net mask from target expression: "/tmp/ip.txt"

@Ullaakut
Copy link
Owner

Ullaakut commented Aug 14, 2021

It seems that the file did not load and the binary tried to interpret the path as an address range with a net mask.

Here is the relevant code.

// LoadTargets parses the file containing hosts to targets, if the targets are
// just set to a file name.
func (s *Scanner) LoadTargets() error {
	if len(s.targets) != 1 {
		return nil
	}

	path := s.targets[0]

	_, err := fs.Stat(path)
	if err != nil {
		return nil
	}

	file, err := fs.Open(path)
	if err != nil {
		return fmt.Errorf("unable to open targets file %q: %v", path, err)
	}
	defer file.Close()

	bytes, err := ioutil.ReadAll(file)
	if err != nil {
		return fmt.Errorf("unable to read targets file %q: %v", path, err)
	}

	s.targets = strings.Split(string(bytes), "\n")

	s.term.Debugf("Successfylly parsed targets file with %d entries", len(s.targets))

	return nil
}

It seems that when running stat on your file, an error is returned and thus Cameradar assumes what you gave was not a path. You must have made a mistake while loading your file in Docker.

Can you show me the contents of your file and the command line you ran? Thanks

@supremepot
Copy link
Contributor Author

the file contain ip like this:

37.148.15.106
88.14.87.108
223.115.173.134
48.179.185.135
205.76.113.24
225.147.112.94
160.195.162.156
9.10.148.112
65.123.255.91
240.58.10.165
123.181.48.81
228.253.22.155
193.182.157.188
93.98.154.70
53.68.76.166

and for mount the file I've tried 2 times with this:

docker run -t -v /my/folder/with/target:/tmp/target
ullaakut/cameradar
-t /tmp/target.txt

and then this

docker run -t -v /tmp:/tmp/ ullaakut/cameradar -t tmp/target

@Prakash2101
Copy link

Prakash2101 commented Aug 16, 2021

@Ullaakut
I'm also facing the same issue, I have followed the steps which were mentioned in the readme.

image

@Ullaakut
Copy link
Owner

Can it be due to line endings like it was for this previous question?

Specific comment in question with the potential solution for both of your issues: #287 (comment)

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

No branches or pull requests

3 participants