| ||||||||||||||
| ||||||||||||||
cross referencing Posted by matt (matt), 18 May 2003 GrahamI am having some problems with, what I thought would be a simple script. I have a two tables that I need to cross reference. In table A I need to take an IP address at $parts[2] and then take a reference number at $parts[5]. I then need to take the reference number from table A ($parts[5]) and compare it against $parts[ 4] in another table i.e. table B and if it matches print out $parts[3] and $parts[ 2] of table B. I have tried numerous solutions and I am now both really confused and really fustrated, please HELP? Matt Posted by admin (Graham Ellis), 19 May 2003 Oh ... I'm bleary-eyed this morning ... let's see if I've understood the question ... you have a fileCode:
and another file Code:
and you want results like Code:
The code that did that is: Code:
Do let me know if I've answered the right question there; if I have and you would like a further description of the program, let me know. If not ... what have I missed and I'll modify the answer. You do need to consider both missing and duplicated match issues, which I have ignored in my program. Posted by matt (matt), 19 May 2003 GrahamThanks for your reply, I am sure your code would work for my situation but again I am having trouble modifying it to suit my needs. This one has really got me confused, I have been writing numerous scripts which have worked perfectly and I thought were more difficult. Typically this one (which I thought was an easy one) has thrown me completely. I have included some sample info (below) so you can help an idiot like me get to grips with my specific problem. ...................................................................... I have two files (examples below) File A: Vulnerabilities result|network|10.0.0.1|100|etc|etc result|network|10.0.0.1|101|etc|etc result|networkA|10.0.0.2|101|etc|etc result|networkB|10.0.0.3|106|etc|etc File B: Report 100|finding: blah blah blah|recommendation: blah blah 101|finding: blah blah blah|recommendation: blah blah what I need to do is to parse the Vulnerbilities file and determine that IP address 10.0.0.1 is vulnerable to reference number 100 and 101. I then need to look at the Report file and take the finding and recommendation for reference number 100 and 101 and print out something like 10.0.0.1 is vulnerbale to 100 and 101 100 equals finding: blah blah blah recommendation: blah blah 101 equals finding: blah blah recommendation: blah blah 10.0.0.2 is vulnerbale to 101 101 equals finding: blah blah recommendation: blah blah 10.0.0.3 is not vulnerable .................................................... I know it looks like I am asking you to write my script for me, but I have really worked myself into a corner and I am struggling to get out of it. Keep up the good work, and thanks in advance. Matt Posted by admin (Graham Ellis), 20 May 2003 One of those mornings where eveything is happening. Quick piece of code, and the results of running it ...Code:
Code:
Not quite the right format, but looks like it does the job otherwise; saved your data into files, changed the report lines so that I could tell them apart ... This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| |||||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |