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

cicflowmeter #626

Closed
AnxiousBunny opened this issue May 20, 2022 · 5 comments
Closed

cicflowmeter #626

AnxiousBunny opened this issue May 20, 2022 · 5 comments
Labels

Comments

@AnxiousBunny
Copy link

iam trying to use this implementation of CICflowmeter, in order to extract the features from a PCAP file, and generating a csv file, the main issue iam facing is, i cant call the cicflowmeter command since its not in the PATH variable, and i cant find the location of the script, altho i specified it in pip section in build-gradle module.
This is the code iam trying to use for the task.

import os

from os.path import dirname, join
def main():
	
	path = join(dirname(__file__),"../../../dumps/dump.pcap")
	path = join(dirname(__file__),"../../../lib")
	sourcepath = path + "dump.csv"
	return os.system("cicflowmeter -f " + path + " -c " + sourcepath)

os.system returns a 32512, which i think it means, command not found, thank you for your great help

@mhsmith
Copy link
Member

mhsmith commented May 20, 2022

You won't be able to launch it as a separate script, because Chaquopy doesn't come with a Python executable. Instead, find out what function the script uses, and call it directly. You can find this in the entry_points / console_scripts section of the setup.py file here.

@mhsmith mhsmith changed the title Where can i find this package cicflowmeter May 21, 2022
@AnxiousBunny
Copy link
Author

Thank You for your response, i edited the the sniffer script to take the parameters from my python code, and it seems to work, but iam running into a dependency issue, that i don't seem to know how to fix, every time i run the code this error shows up, and i have no idea how to provide the libpcap library

2022-05-23 09:55:56.940 8090-9158/com.example.myapplication W/python.stderr: Exception in thread 
2022-05-23 09:55:56.940 8090-9158/com.example.myapplication W/python.stderr: Thread-1
2022-05-23 09:55:56.940 8090-9158/com.example.myapplication W/python.stderr: :
2022-05-23 09:55:56.940 8090-9158/com.example.myapplication W/python.stderr: Traceback (most recent call last):
2022-05-23 09:55:56.940 8090-9158/com.example.myapplication W/python.stderr:   File "/data/data/com.example.myapplication/files/chaquopy/AssetFinder/requirements/scapy/arch/common.py", line 77, in compile_filter
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "import.pxi", line 26, in java.chaquopy.import_override
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "/data/data/com.example.myapplication/files/chaquopy/AssetFinder/requirements/scapy/libs/winpcapy.py", line 38, in <module>
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr: OSError
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr: : 
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr: Cannot find libpcap.so library
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:  
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:  
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr: During handling of the above exception, another exception occurred:
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:  
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr: Traceback (most recent call last):
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "stdlib/threading.py", line 932, in _bootstrap_inner
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "stdlib/threading.py", line 870, in run
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "/data/data/com.example.myapplication/files/chaquopy/AssetFinder/requirements/scapy/sendrecv.py", line 884, in _run
2022-05-23 09:55:56.941 8090-9158/com.example.myapplication W/python.stderr:   File "/data/data/com.example.myapplication/files/chaquopy/AssetFinder/requirements/scapy/utils.py", line 1781, in tcpdump
2022-05-23 09:55:56.942 8090-9158/com.example.myapplication W/python.stderr:   File "/data/data/com.example.myapplication/files/chaquopy/AssetFinder/requirements/scapy/arch/common.py", line 86, in compile_filter
2022-05-23 09:55:56.942 8090-9158/com.example.myapplication W/python.stderr: ImportError
2022-05-23 09:55:56.942 8090-9158/com.example.myapplication W/python.stderr: : 
2022-05-23 09:55:56.942 8090-9158/com.example.myapplication W/python.stderr: libpcap is not available. Cannot compile filter !
2022-05-23 09:55:56.942 8090-9158/com.example.myapplication W/python.stderr:  ```

@mhsmith
Copy link
Member

mhsmith commented May 23, 2022

Unfortunately libpcap isn't one of the libraries we currently provide. If you'd like to try building it yourself, you can use our package build tool. For details, see #175 (comment).

@mhsmith
Copy link
Member

mhsmith commented Feb 2, 2023

The package build tool is now open-source, so if you'd like to try building this package yourself, follow the instructions here. And if you're successful, please make a pull request so we can add the package to the public repository.

@mhsmith
Copy link
Member

mhsmith commented Jun 24, 2023

It's been over a year and only one person has requested this package, so we won't be building it in the foreseeable future.

However, the package build tool is now open-source, so if you'd like to try building this package yourself, follow the instructions here. And if you're successful, please make a pull request so we can add it to the public repository.

If anyone else wants this package, please click the thumbs-up button above and post a comment, and I'll reopen the issue.

@mhsmith mhsmith closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2023
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

2 participants