EG Information
Training Missions
Knowledge Bank
Pimp Us Out!
Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.
|
| |
Affiliates
|
|
Enigma Group's Code Bank
Definition ExtractorBy: blackhat11907 - Date Submitted: 2011-12-25 18:04:56 /* * ShowSource.java * * Created on Dec 24, 2011, 5:08:47 PM */ package web.page.downloader; import java.net.*; import java.io.*; import java.util.regex.*; /** * * @author Blackhat11907 */ public class ShowSource extends javax. swing. JFrame { /** Creates new form ShowSource */ public ShowSource() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { GrabBtn = new javax. swing. JButton(); jLabel1 = new javax. swing. JLabel(); ClearBtn = new javax. swing. JButton(); setTitle("Definition Grabber"); setResizable(false); SourceTxtArea.setColumns(20); SourceTxtArea.setEditable(false); SourceTxtArea.setLineWrap(true); SourceTxtArea.setRows(5); jScrollPane1.setViewportView(SourceTxtArea); GrabBtn.setText("Grab Def"); public void actionPerformed (java. awt. event. ActionEvent evt ) { GrabBtnActionPerformed(evt); } }); jLabel1.setText("Word"); ClearBtn.setText("Clear"); public void actionPerformed (java. awt. event. ActionEvent evt ) { ClearBtnActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(URLTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(GrabBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) . addPreferredGap(javax. swing. LayoutStyle. ComponentPlacement. RELATED, 20, Short. MAX_VALUE) .addComponent(ClearBtn)) . addComponent(jScrollPane1, javax. swing. GroupLayout. DEFAULT_SIZE, 494, Short. MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(GrabBtn) .addComponent(URLTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ClearBtn)) . addContainerGap(18, Short. MAX_VALUE)) ); pack(); }// </editor-fold> // <style.*? means everything from that to after the ? Pattern style = Pattern.compile("<style.*?>.*?</style>"); Matcher mstyle = style.matcher(content); while(mstyle.find()) content = mstyle.replaceAll(""); // removes everything between script tags Pattern script = Pattern.compile("<script.*?>.*?</script>"); Matcher mscript = script.matcher(content); while(mscript.find()) content = mscript.replaceAll(""); // removes primary html tags Pattern tag = Pattern.compile("<.*?>"); Matcher mtag = tag.matcher(content); while(mtag.find()) content = mtag.replaceAll(""); //remove special chars like &67 Pattern sChar = Pattern.compile("&.*?;"); Matcher msChar = sChar.matcher(content); while(msChar.find()) content = msChar.replaceAll(""); //remove tab chars and replace w newline chars Pattern tab = Pattern.compile("<t.*?>"); Matcher mtab = tab.matcher(content); while(mtab.find()) content = mtab.replaceAll("/n"); // erase the first part String infoReg = word + ".*?World English Dictionary"; Pattern info = Pattern.compile(infoReg); Matcher minfo = info.matcher(content); while(minfo.find()) content = minfo.replaceAll(""); // erase the last bottom Pattern info1 = Pattern.compile("Cite This Source.*?FIND OUT.*?Related Words.*?FIND OUT"); Matcher minfo1 = info1.matcher(content); while(minfo1.find()) content = minfo1.replaceAll(""); //erase final Pattern info2 = Pattern.compile("Collins.*?2009"); Matcher minfo2 = info2.matcher(content); while(minfo2.find()) content = minfo2.replaceAll(""); // erase white space Pattern wSpace = Pattern.compile("^[\t]+|[\t]+$"); Matcher mwSpace = wSpace.matcher(content); while(mwSpace.find()) content = mwSpace.replaceAll(""); // tab all lines Pattern tLine = Pattern.compile("[\t]+.*?\\."); Matcher mtLine = tLine.matcher(content); while(mtLine.find()) content = mtLine.replaceAll("\n"); SourceTxtArea.append(content); } String urlAddress = "http://www.dictionary.reference.com/browse/" + URLTxtField. getText(); URL url = new URL(urlAddress ); while ((line = bufferR.readLine()) != null){ content += line + "\t"; } return content; } for (int i = 0; i < word.length(); i++){ String firstL = word. substring(i, i +1); if (i == 0){ result += firstL.toUpperCase(); } else { result += firstL.toLowerCase(); } } return result; } private void GrabBtnActionPerformed (java. awt. event. ActionEvent evt ) { String word = URLTxtField. getText(); try{ content = setInfoAndGrab(); word = addCap(word); parseHtmlCleaner(content, word); SourceTxtArea.append("Failed to connect to server"); } } private void ClearBtnActionPerformed (java. awt. event. ActionEvent evt ) { SourceTxtArea.setText(""); URLTxtField.setText(""); URLTxtField.requestFocus(); } /** * @param args the command line arguments */ /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax. swing. UIManager. LookAndFeelInfo info : javax. swing. UIManager. getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax. swing. UIManager. setLookAndFeel(info. getClassName()); break; } } java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ public void run() { new ShowSource().setVisible(true); } }); } // Variables declaration - do not modify private javax. swing. JButton ClearBtn ; private javax. swing. JButton GrabBtn ; private javax. swing. JLabel jLabel1 ; // End of variables declaration }
|
| Return to
java category list |
|
|
Who Visited EnigmaGroup Today?
1388 Guests, 225 Users (218 Spiders)
cat1vo, lolzsec, tgm001, plex, Edika, TheCheeseDemon, rockcraft, Pabz, recoveryToolbox, saraf, soufiaane, sickmind, mjneat, famous0123, Galagatron, dark_void, CJ_Omaha, junaid_junaid59, JohnJohnJohn, ssmaslov, psychomarine, Dregoon, Patrickk, Aska, Beat_Slayer, M0rdak, Ausome1, Imre, Vreality2007, mmndglxuwn, m0rt, unholyblood, iterrumzz, VurbTrurb, Mayonoula, MAMWOURBROR, mutabor, gobinda, cossyDrybrich, Razin, zaCruBumas8, hunja, johny34, pantoufle, bagy, arctica, hackarchives, UsedDeteKef, Peculator, Fadhilat606, TheTrueMonarch, Pascall01, hackaday, Tjm, arndevil, flairvelocity, lol, alphbond, kdivanov, elizbethallis6, Rik, bn11, BorgBot, SHASHANK101hello, 4poc4lyptic, ksajxai, nbmorri1, electro-technic, شمالي عرعر, lamb, AutobotPrime, Underleaf, The End, tomtombomb, killobyte, snowgirlx, so_saucey, zerolife, Althor, Cramps, Hekser, Hyperborn, cyber-guard, jhgrunn, cobra, Partisan, MAZI_, cyborg, GenbreedX, moel77, cliptoX, pwnpwnlolz, letshavepie, Mrwormz, yshiau, mirmo, roozyoppomo, soft_devil, cls777, scoobywan, Reiversed, joshua, st3alth, Afrika, PaiffDryday, venter, Anthony12796, sh3llcod3, 8FIGURE, Rannim, Evil1, maloaboy, BACanON, SlayingDragons, Repuhlsive, IvanDimitriev, 1RiB, mzungudo, Micro_Geek, iMaxx, aciboummamymn, k0unterkulcher, somebody777, m14m16, GoododotAlcob, negasora, Rastii, UninueMem, Swifsolja, ad.conquest, ngolatkar, Infinity8, Jigoku, thesupervisor, p0is0n5ting, kernel_mod, AKL, GothicLogic, themastersinner, dnatrixene135, ChewBigRed, kalak55, sejem, cve916, pollolololo, triecturn, Violatedsmurf, Ops, jmp, xsiemich, generalisimo, strudels, ga3ttpom, KingOfBritains, epoch_qwert, suten, FriskyKat, Ryuske, Adonis Achilles, ubqbcdzzhf, 3vil, Nightraven, US£RNAM£, Weindittewcon, Batesheelocot, GSmyrlis, MaxMeier, Elite.America, rabbidmind, Psiber_Syn, phoenix22, imittyerrotte, peewster, cyberturtle, ctb, dexgeda, sdw, Pizza, White_widdow, devarian, finesse, Nature112091777, Danc7171, Alphadragon, Estadagause, 53QR10U5, Xargos, Alkomage, hardlock, Barry Gonzoles, MineDweller, Gkjt, N4g4c3N, [I]nfectedbug, wimsteege, aqr5zdcw, xin214, Bugshuppy, SnoopSky, Hessesian, voodooKobra, sKcarr, IROverRated, W1F1G3NJU75U, Baddy, ziadmosaan, gamble86, realzs, CruelDemon, Shinju, aVoid, aquiredanonymity, kukumumu, web_request, callmeneon, KissMyDAFFODIL, Feld Grau, Abhinav2107, prabhataditya, mbuyiselo, shumer, phenom216, princennamdi, huskyboiza, ninety-nine |
| |
|
|
|
|
|