I have a pcap file : a.pcap which contains udp packets.
I can save this a.pcap to text file (.txt) with wireshark GUI. (File -> Save as -> k12 text file).
How can I do the same thing with tshark from command line. I want exactly the same output file as (File -> Save as -> k12 text file).
I have tried commands like:
tshark -T pdml -r 1.pcap -T fields -e data > a.xml
This will result in writing udp payload to a.xml.Not the exact thing I need.
I can save this a.pcap to text file (.txt) with wireshark GUI. (File -> Save as -> k12 text file).
"Text file" covers a number of text file formats, such as:
a file showing the packet summaries as text (the topmost pane of Wireshark, by default);
a file showing the packet details of each packet as text (showing, for each packet, the default middle pane of Wireshark);
a file showing hex dumps of the packet data (showing, for each packet, the default bottommost pane of Wireshark);
a combination of two of those, or of all three of those;
a CSV file of columns from the packet summaries;
a CSV file of particular fields from the packet;
a PSML file showing, as XML, the components of the packet summaries;
a PDML file showing, as XML, the components of the details of each packet;
a JSON file showing the details of each packet;
a C source file showing the raw hex data of the packets, with each packet being in a separate C array of byte values;
a text packet capture format.
So there's no such thing as "the" text format to save a pcap file as; there are a bunch of choices.
"K12 text format" is a text packet capture format; it's what some Tektronix equipment can write out - in that sense, it's similar to writing out the raw hex data, plus some metadata. However, from a user-interface sense, it's more like "Save As..." in Wireshark, because it's a capture file format.
The way you do that is with
tshark -F {output file format} -r {input file} -w {output file}
so, if you want to read the pcap file and write it out as a "K12 text format" file, you can do it with
tshark -F k12text -r a.pcap -w a.txt
You can also do this with editcap:
editcap -F k12text a.pcap a.txt
Related
I want to convert the csv file to pdf file from command line using soffice command. But my csv file is colon separated instead of comma.
If I use command:
soffice --convert-to pdf ./sampleCSVFile.csv
This will give me pdf file but there are ; in the file. I found a article to convert to convert ods to csv with semicolon as delimiter: https://ask.libreoffice.org/t/cli-convert-ods-to-csv-with-semicolon-as-delimiter/5021
So similar to that I tried:
unoconv -f pdf -e FilterOptions="59,34,0,1" ./sampleCSVFile.csv
But it didn't help.
sampleCSVFile.csv as follow:
Level 1;Level2
Level 1;Level2
Level 1 ;Level2
Level 1;Level2
Level 1 ;Level2
Level 1;Level2
Level 1;Level2
Level 1;Level2
Level 1;Level2
Is there a way to convert this colon separated csv file to pdf?
(without changing the delimiter colon to comma)
Traditionally in DOS you used Edline to write a text file then either Copy or Type to the Con, Com or Lpn device (Line PriNter).
Windows still allows the print command to do that, and its possible to echo text via Notepad to a PDF virtual printer as a port. I will skip that as it not quite suited to your usage.
However by way of example, here I take your file and print virtually to PDF FilePort then call the Port result to the console. I could use one line rather than two but its more GUI visual.
However its not cross platform, and there are other simpler ways to convert text to pdf per platform.
You ask about Soffice and the principles are much the same since before PDFs were invented. soffice --infilter="calc_pdf_export" --convert-to pdf sampleCSVFile.csv
The text you transPort to exPort is the same as you imPort. However printing blind can add default print headers, footers (Page 1) and styles.
Because it is the most basic of methods
Whatever is in your Character Separated Values File.txt will be similar output. The only difference is there is no such thing as a tab or line wrap in a PDF (as its a virtual laser printer) not a mechanical line feed one.
I am able to embed text data into wav audio file using StegHide
steghide embed -cf filename.wav -ef filename.txt
and for extracting:
steghide extract -sf filename.wav
but with this I am only able to hide my text document into an audio file, I need something else: ho tide the text itself (not the text document) in wav audio file using Hex Editor.
Any suggestions?
I am generating a logfile on one of my servers.
Storing alot of data, then sending it to my mail once a month as a pdf file.
The prosess i am using is to 'cat' alot of commands to a text file, then convert it and send.
Is there any linux programs or some eazy way to do something simulare and add a image i have stored on the server in the pdf file?
This answer assumes that you just want to put the image at the end of the PDF.
You could first convert the image using imagemagick to a PDF doing this (will also work with different file types):
convert image.jpg image.pdf
Then, you can use a tool like stapler or pdftk to combine your generated text PDF and the image.pdf (you can add multiple images):
stapler cat text.pdf image.pdf combined.pdf
pdftk text.pdf image.pdf output combined.pdf
I am looking for an efficient way to import the data from a bunch of text files into an .ods file. I have no problem in processing the text files with commands like grep and sed, however, I do not know if it is possible to redirect the results of these commands into a certain location in an ods file.
The .ods file format is basically an xml file format. In the case of .fods it is straight xml. In the case of .ods it is zipped xml. So directly inserting content from text files will likely require some xml tools. I'm using Ubuntu and found xml2/2xml could be useful for converting between xml and xml-path-style text. (sudo apt-get install xml2)
So you will have to do the following:
unzip the .ods file - the cell data will be in a file called content.xml
xml2 < content.xml to get raw text out of the xml
Edit the raw text with your content
Convert the edited raw text back to xml using 2xml
Rezip up the previously unzipped .ods, including your edited content
This may be quite an involved/cumbersome process. Alternatively I'd suggest simply saving your .ods file as a .csv file instead and directly editing the comma-separated-values.
Sorry if this belongs on serverfault
I'm wondering what the proper way is to use an SVG(xml) string as standard input
for a "convert msvg:- jpeg:- 2>&1" command (using linux)
Currently I'm just saving a temp file to use as input,
but the data originates from an API in my case, so feeding
the string directly to the command would obviously be most efficient.
I appreciate everyone's help. Thanks!
This should work:
convert - output.jpg
Example:
convert logo: logo.svg
cat logo.svg | convert - logo.jpg
Explanation:
The example's first line creates an SVN file and writes it to disk. This is only a preparatory stop so that we can run the second line.
The second line is a pipeline of two commands: cat streams the bytes of the file to stdout (standard output).
The first line served only as preparation for the next command in the pipeline, so that this next command has something to read in.
This next command is convert.
The - character is a way to tell convert to read its input data not from disk, but from stdin (standard input).
So convert reads its input data from its stdin and writes its JPEG output to the file logo.jpg.
So my first command/line is similar to your step described as 'currently I'm just saving a temp file to use as input'.
My second command/line does not use your API (I don't have access to it, do I?), but it demonstrates a different method to 'feeding a string directly to the command'.
So the most important lesson is this: Whereever convert would usually read input from a file and where you would write the file's name on the commandline, you can replace the filename by - to tell convert it should read from stdin. (But you need to make sure that there is actually something offered on convert's standard input which it can digest...)
Sorry, I can't explain better than this...