hacking contest

hacking exploits security forum
hacking
compliance articles
upgrade backup exec
information security consultant

epi
Basically, you have two files... source.txt and dictionary.txt. i want the program to look in source.txt for any matches with words in dictionary.com... then just makes result.txt which states which matches have been made "i.e carrot apple elf" etc

How would i make/find this program? Thanks.
withdraw
I think this might do it
http://www.guiffy.com/
but I havent tried it out yet....
But it works on almost any platform!! biggrin.gif
nuorder
is source.txt a lot of sentences or just a list of words with a newline after each word
epi
Source is sort of like a lot of sentences. For eg

QUOTE
ygՁo lY*E.n  {Ui( w Qހ
(4P XICC_PROFILE   HLino  mntrRGB XYZ     1  acspMSFT    IEC sRGB                  -HP                                                cprt  P  3desc    lwtpt    bkpt    rXYZ    gXYZ  ,  bXYZ  @  dmnd  T  pdmdd    vued  L  view    $lumi    meas      $tech  0    rTRC  <   gTRC  <   bTRC  <   text    Copyright © 1998 Hewlett-Packard Company  desc      sRGB IEC61966-2.1          sRGB IEC61966-2.1                                                  XYZ      Q   XYZ                XYZ      o  8  XYZ      b    XYZ      $    desc      IEC http://www.iec.ch          IEC http://www.iec.ch                                              desc      .IEC 61966-2.1 Default RGB colour space - sRGB          .IEC 61966-2.1 Default RGB colour space - sRGB                      desc      ,Reference Viewing Condition in IEC61966-2.1          ,Reference Viewing Condition in IEC61966-2.1                          view     _.    \  XYZ      L V P  Wmeas                          sig    CRT curv          


There are hidden words in the file, i want a program that searches the file for words.
nuorder
ok heres a rough idea of what u need
the code probly needs to be redone cos i havnt check it much but it worked with the small amount of data i gave it
CODE
#include <fstream.h>
#include <stdlib.h>
#include <string.h>
#define MAX 255

void main ()
{
ifstream in1;
ifstream in2;
ofstream out;
int cur1,cur2;
char str_in1[MAX];
char str_in2[MAX];
char * c;

//open files
in1.open("source.txt",ios::nocreate);
out.open("results.txt");

//loops to look for the strings
while ( (cur1=in1.peek()) != EOF )
{
 in1.getline(str_in1,MAX,'\n');
 
 //look in the dictionary - i shouldnt really be opening this file over and over but it works
 in2.open("dictionary.txt",ios::nocreate);
 while ( (cur2=in2.peek()) != EOF )
 {
  in2.getline(str_in2,MAX,'\n');
  cout << str_in2 << endl;
  c = strstr (str_in1,str_in2);
  //check if its there and output
  if (c != NULL)
   out << str_in2 << endl;
 }
 in2.close();
 cout << "yo" << endl;
}
in1.close();
out.close();
}
also doesnt account for duplicate results in the search - but could be implemented without too much hassle

the VB eqivalent would basically be the same idea and use the instr() function to find the substring (dictionary) within the source string
epi
Thanks smile.gif I'm going to have a look through it and see if i can make sense of it, hehe.. smile.gif
BBQ CD
maybe textpad (www.textpad.com) is the tool u're searching for, give it a try
n0n4m3
well, i think i know a good program for you. it's called "remdupes 2" search for it via google, i'm sure you'll find it smile.gif

it's easy to use, if there are any questions, ask me, maybe i can help you, but it's very easy to use...

cya
noname
typecast
You could easily do this task in perl. This should give you the idea how to do this:
CODE

#!/usr/bin/perl

open($WORDFILE, "dictionary.txt");
open($SOURCEFILE, "source.txt");

# maybe you shouldn't do this with huge files :D
@source=<$SOURCEFILE>;

while ( $testedword = <$WORDFILE> ) {
   chop $testedword;
   for (@source) {
       print "Matched $testedword in sourcefile\n" if /$testedWord/;
   }
}

(This also doesn't count dublicate results, but it's also easy to implement this)
net_runner
nice post, thanks
(i just installed textpad smile.gif )
z73
QUOTE

You could easily do this task in perl. This should give you the idea how to do this:

CODE


#!/usr/bin/perl

open($WORDFILE, "dictionary.txt");
open($SOURCEFILE, "source.txt");

# maybe you shouldn't do this with huge files :D
@source=<$SOURCEFILE>;

while ( $testedword = <$WORDFILE> ) {
  chop $testedword;
  for (@source) {
      print "Matched $testedword in sourcefile\n" if /$testedWord/;
  }
}


(This also doesn't count dublicate results, but it's also easy to implement this)

With bigger filez u could get a prob with "@source=<$SOURCEFILE>;". File could get to big for it and u would have to use 2 while loops, one loop within the other.
typecast
QUOTE (z73 @ Sep 14 2004, 01:59 PM)
With bigger filez u could get a prob with "@source=<$SOURCEFILE>;". File could get to big for it and u would have to use 2 while loops, one loop within the other.

Yes, that's why i wrote:

# maybe you shouldn't do this with huge files biggrin.gif

This peace of code should only give the idea of how to do this in perl.
z73
QUOTE (typecast @ Sep 14 2004, 08:30 PM)
QUOTE (z73 @ Sep 14 2004, 01:59 PM)
With bigger filez u could get a prob with "@source=<$SOURCEFILE>;". File could get to big for it and u would have to use 2 while loops, one loop within the other.

Yes, that's why i wrote:

# maybe you shouldn't do this with huge files biggrin.gif

This peace of code should only give the idea of how to do this in perl.

Heh i knew u know bout it biggrin.gif perl is the best approach for this task. Ur suggestion was nice. Just tried to explain it to the others
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.

 
Invision Power Board © 2001-2005 Invision Power Services, Inc.