473,508 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to parse a text file through PERL into MySQL?

5 New Member
I have to make a project on Vulnerability Management System so I've generated a text report related to vulnerability scan. Now I have to parse this report into mysql. So please tell me how can I do this??
Dec 18 '10 #1
9 2621
chorny
80 Recognized Expert New Member
If this report is in CSV format, you can use Text::CSV module to parse it.
Dec 18 '10 #2
numberwhun
3,509 Recognized Expert Moderator Specialist
Easy, use Perl. :) I know, simplistic answer.

The hard part is we have no clue what this report looks like. If the report is a list of lines, each containing a set of data, then you could split each line into its parts and input the data into the database using DBI. No matter what format it is, you just need to figure out how to parse each element you need out, then use DBI to input the data into the db table(s) you create(d).

Write code and do what you can. If you have issues with the coding, post your code and data samples here and we will help you where you get stuck.

Regards,

Jeff
Dec 18 '10 #3
akshay mokhalga
5 New Member
The file type is .nbe . I show a sample type of that file:
results|IP REMOVED|IP REMOVED|general/udp|10287|Security Note|\nSynopsis :\n\nIt was possible to obtain traceroute information.\n\nDescription :\n\nMakes a traceroute to the remote host.\n\nSolution :\n\nn/a\n\nRisk factor :\n\nNone\n\nPlugin output :\n\nFor your information, here is the traceroute from IP REMOVED to IP REMOVED : \nIP REMOVED\nIP REMOVED\n\n
This is a small part of that file so tell me how I can do parsing of this file also tell me what pattern I can follow to parse it.
Dec 19 '10 #4
chorny
80 Recognized Expert New Member
You should have started with information that you use Nessus.
Try Parse::Nessus::NBE from CPAN. It is old, but if .nbe format did not change, it will work.
Dec 19 '10 #5
numberwhun
3,509 Recognized Expert Moderator Specialist
@akshay mokhalga Please do not post IP Addresses, Email addresses, or any other personal information in the forums. Information posted here is scrapable from the internet and not guarded as it would be on private sites.
I have removed your IP information, please be more mindful next time.

Regards,

Jeff
Dec 19 '10 #6
akshay mokhalga
5 New Member
@Jeff:-ok Jeff I will take care of this in future....
Dec 19 '10 #7
numberwhun
3,509 Recognized Expert Moderator Specialist
Also, using quote tags around your samples better separates the sample from the rest of the post's text, that way we don't have to guess what your sample is and what your comment is.

Regards,

Jeff
Dec 19 '10 #8
akshay mokhalga
5 New Member
I have one more question how can I call a perl program through C compiler??
Dec 27 '10 #9
chorny
80 Recognized Expert New Member
> I have one more question how can I call a perl program through C compiler??

1. You can use exec or system (I don't remember this part of C, so you need to look yourself).

2. You can embed Perl into your program. See perlembed.pod.
Dec 27 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
11990
by: John M. Lembo | last post by:
I am using Perl to parse a text file and output to another file. The text file has data on Unix virtual memory (vmstat) and I want to delete lines that I don't want and output lines that I want to...
2
12063
by: Tyaan | last post by:
Hi.. I'm a perl noob need to know how to write a script to parse a file containing one to four of the following blocks of text? I then want to print the results in a format showing the memory size...
2
1590
by: Jamie | last post by:
A B C D E F G H I J K L M N O P Q R insert into test (building,dep,owner,pcdesc,host,pctag,os,sp) values (' A ,' Catering ,' User 3 ,' EVO N410 ,' PC24346 ,' TAG-24346 ,' WIN 2000 ,' 4 ); insert...
2
15544
by: Sacha Korell | last post by:
How would I check for an end of file when parsing a text file using the StreamReader object? I would like to do something like this: '******************************** Dim objStreamReader As...
3
18695
by: boukaka | last post by:
Hi there, I have a text file that does not have any delimiters - it is simply assumed that I know how long each field is and they are always in the same order. (i.e. JOHN DOE ...
0
1414
by: ramaraog80 | last post by:
Hi, I want VB Script which exports data from a text file to MySql Tables. Please help me regarding this. Regards Ramarao G
2
2128
by: kkazakos | last post by:
Hello, I am a newbie in perl and i have the following problem. I have as input a text file in the following format:...
3
1961
by: vaibhavkansara | last post by:
Hello friends, I am vaibhav I am a new to PHP/MYSQL.I have a problem to uploading a text file into MYSQL using php, and a text file is a tabdelimited file so pleas give me solution as soon as...
12
4395
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
1
2942
by: Noorain | last post by:
sir my data are in text file. i want import text file in mysql data to use php script. please help me............. my text file is 1#AA#2,345.00 2#BB#850.00 3#CC#31,855.00
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.