EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff
Hacker's Home Page

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

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.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Code Bank


Definition Extractor

By: blackhat11907  -  Date Submitted: 2011-12-25 18:04:56

  1. /*
  2.  * ShowSource.java
  3.  *
  4.  * Created on Dec 24, 2011, 5:08:47 PM
  5.  */
  6. package web.page.downloader;
  7. import java.net.*;
  8. import java.io.*;
  9. import java.util.regex.*;
  10.  
  11. /**
  12.  *
  13.  * @author Blackhat11907
  14.  */
  15.  
  16. public class ShowSource extends javax.swing.JFrame {
  17.  
  18. /** Creates new form ShowSource */
  19. public ShowSource() {
  20. initComponents();
  21. }
  22.  
  23. /** This method is called from within the constructor to
  24.   * initialize the form.
  25.   * WARNING: Do NOT modify this code. The content of this method is
  26.   * always regenerated by the Form Editor.
  27.   */
  28. @SuppressWarnings("unchecked")
  29. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  30. private void initComponents() {
  31.  
  32. jScrollPane1 = new javax.swing.JScrollPane();
  33. SourceTxtArea = new javax.swing.JTextArea();
  34. URLTxtField = new javax.swing.JTextField();
  35. GrabBtn = new javax.swing.JButton();
  36. jLabel1 = new javax.swing.JLabel();
  37. ClearBtn = new javax.swing.JButton();
  38.  
  39. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  40. setTitle("Definition Grabber");
  41. setResizable(false);
  42.  
  43. SourceTxtArea.setColumns(20);
  44. SourceTxtArea.setEditable(false);
  45. SourceTxtArea.setLineWrap(true);
  46. SourceTxtArea.setRows(5);
  47. jScrollPane1.setViewportView(SourceTxtArea);
  48.  
  49. GrabBtn.setText("Grab Def");
  50. GrabBtn.addActionListener(new java.awt.event.ActionListener() {
  51. public void actionPerformed(java.awt.event.ActionEvent evt) {
  52. GrabBtnActionPerformed(evt);
  53. }
  54. });
  55.  
  56. jLabel1.setText("Word");
  57.  
  58. ClearBtn.setText("Clear");
  59. ClearBtn.addActionListener(new java.awt.event.ActionListener() {
  60. public void actionPerformed(java.awt.event.ActionEvent evt) {
  61. ClearBtnActionPerformed(evt);
  62. }
  63. });
  64.  
  65. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  66. getContentPane().setLayout(layout);
  67. layout.setHorizontalGroup(
  68. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  69. .addGroup(layout.createSequentialGroup()
  70. .addContainerGap()
  71. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  72. .addGroup(layout.createSequentialGroup()
  73. .addComponent(jLabel1)
  74. .addGap(18, 18, 18)
  75. .addComponent(URLTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
  76. .addGap(18, 18, 18)
  77. .addComponent(GrabBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
  78. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
  79. .addComponent(ClearBtn))
  80. .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 494, Short.MAX_VALUE))
  81. .addContainerGap())
  82. );
  83. layout.setVerticalGroup(
  84. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  85. .addGroup(layout.createSequentialGroup()
  86. .addContainerGap()
  87. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
  88. .addGap(18, 18, 18)
  89. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  90. .addComponent(jLabel1)
  91. .addComponent(GrabBtn)
  92. .addComponent(URLTxtField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  93. .addComponent(ClearBtn))
  94. .addContainerGap(18, Short.MAX_VALUE))
  95. );
  96.  
  97. pack();
  98. }// </editor-fold>
  99.  
  100. public void parseHtmlCleaner(String content, String word) {
  101.  
  102. // <style.*? means everything from that to after the ?
  103. Pattern style = Pattern.compile("<style.*?>.*?</style>");
  104. Matcher mstyle = style.matcher(content);
  105. while(mstyle.find()) content = mstyle.replaceAll("");
  106.  
  107. // removes everything between script tags
  108. Pattern script = Pattern.compile("<script.*?>.*?</script>");
  109. Matcher mscript = script.matcher(content);
  110. while(mscript.find()) content = mscript.replaceAll("");
  111.  
  112. // removes primary html tags
  113. Pattern tag = Pattern.compile("<.*?>");
  114. Matcher mtag = tag.matcher(content);
  115. while(mtag.find()) content = mtag.replaceAll("");
  116.  
  117. //remove special chars like &67
  118. Pattern sChar = Pattern.compile("&.*?;");
  119. Matcher msChar = sChar.matcher(content);
  120. while(msChar.find()) content = msChar.replaceAll("");
  121.  
  122. //remove tab chars and replace w newline chars
  123. Pattern tab = Pattern.compile("<t.*?>");
  124. Matcher mtab = tab.matcher(content);
  125. while(mtab.find()) content = mtab.replaceAll("/n");
  126.  
  127. // erase the first part
  128. String infoReg = word + ".*?World English Dictionary";
  129. Pattern info = Pattern.compile(infoReg);
  130. Matcher minfo = info.matcher(content);
  131. while(minfo.find()) content = minfo.replaceAll("");
  132.  
  133. // erase the last bottom
  134. Pattern info1 = Pattern.compile("Cite This Source.*?FIND OUT.*?Related Words.*?FIND OUT");
  135. Matcher minfo1 = info1.matcher(content);
  136. while(minfo1.find()) content = minfo1.replaceAll("");
  137.  
  138. //erase final
  139. Pattern info2 = Pattern.compile("Collins.*?2009");
  140. Matcher minfo2 = info2.matcher(content);
  141. while(minfo2.find()) content = minfo2.replaceAll("");
  142.  
  143. // erase white space
  144. Pattern wSpace = Pattern.compile("^[\t]+|[\t]+$");
  145. Matcher mwSpace = wSpace.matcher(content);
  146. while(mwSpace.find()) content = mwSpace.replaceAll("");
  147.  
  148. // tab all lines
  149. Pattern tLine = Pattern.compile("[\t]+.*?\\.");
  150. Matcher mtLine = tLine.matcher(content);
  151. while(mtLine.find()) content = mtLine.replaceAll("\n");
  152.  
  153.  
  154. SourceTxtArea.append(content);
  155. }
  156.  
  157. public String setInfoAndGrab() throws IOException {
  158. String urlAddress = "http://www.dictionary.reference.com/browse/" + URLTxtField.getText();
  159.  
  160. URL url = new URL(urlAddress);
  161. String line = null;
  162. String content = "";
  163.  
  164. URLConnection con = url.openConnection();
  165. InputStream is = con.getInputStream();
  166.  
  167.  
  168. while ((line = bufferR.readLine()) != null){
  169.  
  170. content += line + "\t";
  171.  
  172. }
  173. return content;
  174. }
  175.  
  176. public String addCap(String word){
  177.  
  178. String result = "";
  179. for (int i = 0; i < word.length(); i++){
  180. String firstL = word.substring(i, i +1);
  181. if (i == 0){
  182. result += firstL.toUpperCase();
  183. } else {
  184. result += firstL.toLowerCase();
  185. }
  186. }
  187.  
  188. return result;
  189. }
  190.  
  191.  
  192. private void GrabBtnActionPerformed(java.awt.event.ActionEvent evt) {
  193.  
  194. String content = "";
  195. String word = URLTxtField.getText();
  196. try{
  197.  
  198. content = setInfoAndGrab();
  199. word = addCap(word);
  200. parseHtmlCleaner(content, word);
  201.  
  202. } catch (Exception ex) {
  203. SourceTxtArea.append("Failed to connect to server");
  204. }
  205.  
  206.  
  207. }
  208.  
  209. private void ClearBtnActionPerformed(java.awt.event.ActionEvent evt) {
  210.  
  211. SourceTxtArea.setText("");
  212. URLTxtField.setText("");
  213. URLTxtField.requestFocus();
  214.  
  215. }
  216.  
  217. /**
  218.   * @param args the command line arguments
  219.   */
  220. public static void main(String args[]) throws IOException {
  221. /* Set the Nimbus look and feel */
  222. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  223. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  224.   * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  225.   */
  226. try {
  227. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  228. if ("Nimbus".equals(info.getName())) {
  229. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  230. break;
  231. }
  232. }
  233. } catch (ClassNotFoundException ex) {
  234. java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  235. } catch (InstantiationException ex) {
  236. java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  237. } catch (IllegalAccessException ex) {
  238. java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  239. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  240. java.util.logging.Logger.getLogger(ShowSource.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  241. }
  242. //</editor-fold>
  243.  
  244. /* Create and display the form */
  245. java.awt.EventQueue.invokeLater(new Runnable() {
  246.  
  247. public void run() {
  248. new ShowSource().setVisible(true);
  249. }
  250. });
  251.  
  252. }
  253. // Variables declaration - do not modify
  254. private javax.swing.JButton ClearBtn;
  255. private javax.swing.JButton GrabBtn;
  256. private javax.swing.JTextArea SourceTxtArea;
  257. private javax.swing.JTextField URLTxtField;
  258. private javax.swing.JLabel jLabel1;
  259. private javax.swing.JScrollPane jScrollPane1;
  260. // End of variables declaration
  261. }
  262.  
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
 
Enigma Group