Sep 252000
 

I wrote this to bulk spam mail newsgroups advertising my bin laden beat em up. Someone may find this code useful. Due to sandbox restrictions it won’t run from a webpage without granting special permissions so I haven’t bothered making the page for it.

import java.awt.*;
import java.applet.*;
import  java.net.*;
import java.io.*;
import java.awt.event.*;
import  com.ms.security.*;

public class AtNews extends Applet implements  ActionListener, ItemListener {

private final int Port=119;
private int lineCount;

private String server, username,  password, from, subject, body, groups[][], groupComp;

private InetAddress HostAddr;
private Socket Sock;
private  BufferedReader In;
private PrintWriter Out;

private  TextField tf_server, tf_login_name, tf_login_password, tf_from,  tf_subject, tf_group_file;
private Checkbox cb_login;
private TextArea ta_body, ta_response;
private Button b_send,  b_group_file;

protected File f_group_file;

public  void init(){
//      NewsHost = "202.85.164.51"
//      NewsHost =  "news.tcp.co.uk";
//      NewsHost = "graf.CS.Uni-Magdeburg.De";

tf_server = new TextField("News Server",25);
cb_login = new Checkbox("Username/Password Required",false);

tf_login_name = new TextField("Login Name",25);
tf_login_name.setEditable(false);
tf_login_password = new  TextField("Login Password",25);
tf_login_password.setEditable(false);
tf_from = new  TextField("From",25);
tf_subject = new TextField("Message  Subject",25);

b_group_file = new Button();
b_group_file.setLabel("Select Group File");
tf_group_file =  new TextField("Group File",25);
tf_group_file.setEditable(false);

ta_body = new  TextArea("Message Body",5,25);
ta_body.setText("Message Body");
ta_response = new TextArea("Server Response",5,25);
ta_response.setText("Server Response");
ta_response.setEditable(false);

b_send = new  Button();
b_send.setLabel("Send");

this.add(tf_server);
cb_login.addItemListener(this);
this.add(cb_login);
this.add(tf_login_name);
this.add(tf_login_password);
this.add(tf_from);
this.add(b_group_file);
b_group_file.addActionListener(this);
this.add(tf_group_file);
this.add(tf_subject);
this.add(ta_body);
this.add(b_send);
b_send.addActionListener(this);
this.add(ta_response);

local();
}

private void local(){
tf_server.setText("20.80.164.51");
tf_login_name.setText("news22826");
tf_login_password.setText("password");
tf_from.setText("email@email.com");
tf_subject.setText("Heading");
ta_body.setText("Body");
}

public void itemStateChanged(ItemEvent ie){
if (cb_login.getState()){
tf_login_name.setEditable(true);
tf_login_password.setEditable(true);
} else {
tf_login_name.setEditable(false);
tf_login_password.setEditable(false);
}
}

public void actionPerformed(ActionEvent ae){
if  (ae.getSource()==b_group_file){
try {
File  group_file = getFile();
setFile(group_file);
tf_group_file.setText(group_file.toString());
} catch  (Exception e){
tf_group_file.setText("NO GROUP FILE  SELECTED");
}
}
if  (ae.getSource()==b_send){
retrievePrams();
}
}

public void start(){
//      readMessage();
//       try {readGroups();} catch (Exception e){System.out.println("Failed  reading groups : "+e);}
//      try {connect();} catch (Exception  e){System.out.println("From connect fail : "+e);}
//      try  {login();} catch (Exception e){   System.out.println("From login fail :  "+e);}
/*      sendString("QUIT",true);
try {
In.close();
Out.close();
} catch (Exception e){}*/
}

public void destroy(){
try {
In.close();
Out.close();
} catch (Exception e){}
}

public File getFile(){
try {
if  (Class.forName("com.ms.security.PolicyEngine") != null) {
PolicyEngine.assertPermission(PermissionID.UI);
}
} catch (Throwable cnfe) {System.out.println(cnfe);}

FileDialog fd_GroupFile = new FileDialog (new Frame(),"Slect USENET  Group file",FileDialog.LOAD);
fd_GroupFile.setVisible(true);
File f_groupFile = new File  (fd_GroupFile.getDirectory(),fd_GroupFile.getFile());
return  f_groupFile;
}

public void setFile(File group_file){
f_group_file=group_file;
}

private void  retrievePrams(){
boolean fail = false;
if  ((tf_server.getText().equals("News  Server"))||(tf_server.getText().equals("ENTER NEWSSERVER"))){
tf_server.setText("ENTER ENTER NEWSSERVER");
fail = true;
}
if (cb_login.getState()){
if  ((tf_login_name.getText().equals("Login  Name"))||(tf_login_name.getText().equals("ENTER USERNAME"))){
tf_login_name.setText("ENTER USERNAME");
fail =  true;
}
if  ((tf_login_password.getText().equals("Login  Password"))||(tf_login_password.getText().equals("ENTER PASSWORD"))) {
tf_login_password.setText("ENTER PASSWORD");
fail = true;
}
}
if  ((tf_from.getText().equals("From"))||(tf_from.getText().equals("ENTER  FROM"))){
tf_from.setText("ENTER FROM");
fail =  true;
}
if ((tf_subject.getText().equals("Message  Subject"))||(tf_subject.getText().equals("ENTER SUBJECT"))){
tf_subject.setText("ENTER SUBJECT");
fail = true;
}
if ((tf_group_file.getText().equals("Group  File"))||(tf_group_file.getText().equals("NO GROUP FILE SELECTED"))){
tf_group_file.setText("NO GROUP FILE SELECTED");
fail = true;
}
if ((ta_body.getText().equals("Message  Body"))||(ta_body.getText().equals("ENTER MESSAGE BODY"))){
ta_body.setText("ENTER MESSAGE BODY");
fail = true;
}
if (!fail){
server = tf_server.getText();
from = tf_from.getText();
subject=tf_subject.getText();
username=tf_login_name.getText();
password=tf_login_password.getText();
subject=tf_subject.getText();
body=ta_body.getText();
try {readGroups(f_group_file);}
catch (IOException  ioe) {}
ta_response.setText("");
comms();
}
}

public void comms(){
//      try  {connect();} catch (IOException ioe){ta_response.append("L: Error  Reading Groups : "+ioe+"\r\n");}
if (cb_login.getState())
login();
//      try {
for (int  a=0;a<groups.length;a++){
groupComp=" ";
for (int b=0;b<10;b++){
if (groups[a][b]==null)
break;
groupComp=groupComp+groups[a][b]+",";
}
int stringLength = groupComp.length();
groupComp =  groupComp.substring(0,groupComp.length()-1);
//             post(groupComp);
System.out.println(groupComp);
}
//      } catch (IOException ioe){ta_response.append("L: Server  not Responding : "+ioe+"\r\n");}

//       sendString("QUIT",true);
try {
In.close();
Out.close();
} catch (Exception e){}

}

public void readGroups(File f_groupFile) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(new  FileInputStream(f_groupFile)));
do {
lineCount++;
} while (in.readLine()!=null);
in.close();

groups = new String[((lineCount-1)/10)+1][10];

BufferedReader in2 = new BufferedReader(new InputStreamReader(new  FileInputStream(f_groupFile)));
for (int  a=0;a<groups.length;a++){
for (int b=0;b<10;b++){
groups[a][b]=in2.readLine();
}
}
in2.close();
}

public void connect() throws  IOException {
try {
if  (Class.forName("com.ms.security.PolicyEngine") != null) {
PolicyEngine.assertPermission(PermissionID.SYSTEM);
}
} catch (Throwable cnfe) {System.out.println(cnfe);}

HostAddr=InetAddress.getByName(server);
Sock=new  Socket(HostAddr, Port);
In = new BufferedReader(new  InputStreamReader(Sock.getInputStream()));
Out=new  PrintWriter(new BufferedOutputStream(Sock.getOutputStream()));
ta_response.append("S: "+getResponse()+"\r\n");
}

private String getResponse() throws IOException {
String  line=In.readLine();
//      System.out.println(line);
return  line;
}

public void post(String  groupsMulti) throws IOException {
int code;
String  NewBody;

sendString("post",true);
sendString("From: "+from+"\r\nSubject:  "+subject+"\r\nNewsgroups:"+groupsMulti+"\r\nBody: \r\n",false);
//          sendString("\r\n",false);
sendString(body,false);
sendString(".\r\n",true);
}

private void  login() {
sendString("AUTHINFO USER "+username,true);
sendString("AUTHINFO PASS "+password,true);
}

private synchronized void sendString(String command, boolean response){
try {
Out.println(command);
if  (response){
ta_response.append("L: "+command+"\r\n");
Out.flush();
ta_response.append("S:  "+getResponse()+"\r\n");
}
}    catch (Exception  e){
System.out.println("Exception with "+command+" =  "+e.getMessage());
}
}
}

Share

 Leave a Reply

CAPTCHA Image

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

WP-SpamFree by Pole Position Marketing