Inspiration- We set out to make a shoddy antivirus program. We originally wanted to use this to protect users in different ways from SECONDDATE Exploits.
What it does- Searches through a text file for a specific word or phrase and returns true or false based on the outcome of the search.
How we built it- We used Java and originally set it up to only search a single line. However, we have stopped while writing code to make it search multiple lines in the hope of searching through an entire text file.
Challenges we ran into- making the software search through individual lines of code.
Accomplishments that we're proud of- making it search through a single line of code.
What we learned- new Java syntax and methods.
What's next for Unfinished Line Searcher- Hopefully, we can finish this program and search all types of files for different file signatures and categorize those files based on their signatures.
import static java.lang.System.out; import static java.nio.file.Files.readAllBytes; import static java.nio.file.Paths.get; import java.io.; import java.util.;
//By Abiri Aratow public class Runner {
public static void main(String args[]) throws IOException {
ArrayList<String> keys = new ArrayList<String>();
try {
File file = new File("key.txt");
Scanner scanner = new Scanner(file);
while (scanner.hasNext()) {
keys.add(scanner.next());
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
System.out.println(keys.toString());
String file = new String(readAllBytes(get("test.txt")));
System.out.println(file);
System.out.println(checkFile(file, "hello no"));
}
public static boolean checkFile(String file, String phrase) {
if(file.length() < phrase.length()) {
return false;
} else if(file.substring(0, phrase.length()).equals(phrase)) {
return true;
}
return checkFile(file.substring(1), phrase);
}
}