Comments (3)
Completed in JS for now to simplify the asynchronous aspect. Thanks @kYroL01 feel free to think about this long range :)
from webshark.
rebooting attempt!
A potential lightweight route could be adding URL path detection (^http.*
) in filenames passed to the cf_open function by the application, and using a sidekick curl function to fetch the file before passing it to the load_cap_file function again.
- load_cap_file( 'http://localhost/some.pcap', ... )
- cf_open detect ^http, call curl sidekick
- curl fetch and store file (http://localhost/some.pcap > /capture/some,pcap)
- cf_open('/capture/some.pcap')
#include <stdio.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include <string>
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
size_t written = fwrite(ptr, size, nmemb, stream);
return written;
}
int main(void) {
CURL *curl;
FILE *fp;
CURLcode res;
char *url = "http://localhost/some.pcap";
char outfilename[FILENAME_MAX] = "/capture/some.pcap";
curl = curl_easy_init();
if (curl) {
fp = fopen(outfilename,"wb");
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/some.pcap");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
fclose(fp);
}
return 0;
}
from webshark.
This is the standalone test to be converted in a function and called to the correct position in sharkd
https://gist.github.com/kYroL01/b92fa0d7664b92a17575227239c17076
./curl_pcap "http://www.example/file.pcap"
-> download the pcap
from webshark.
Related Issues (20)
- imagestore HOT 6
- Timestamps not preserved HOT 1
- Read pcaps from subdirectory HOT 3
- failures on new image build HOT 8
- Error trying to connect to /var/run/sharkd.sock HOT 5
- Login page HOT 1
- req is not a valid member name HOT 6
- Can not spawn /var/run/sharkd.sock on a container HOT 1
- 'Analyze' and 'Decode as' options for Pcaps HOT 2
- Extraneous files in repo HOT 1
- New User-Interface
- Docker example command broken HOT 2
- docker start error HOT 3
- Missing RTP Audio
- sharkd failing to start with source build HOT 1
- PCMA/8000 & PCMU/8000 are not supported HOT 1
- uploading error HOT 2
- Add Plugin Support HOT 3
- Cannot open capture HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webshark.