Jump to content

Malcolm

Global Moderator
  • Posts

    131834
  • Joined

  • Last visited

  • Days Won

    21
  • Feedback

    100%

Everything posted by Malcolm

  1. I used to troll a bit with my twitter by tweeting out updates when my bots would gain certain levels or I would mule a certain amount. I felt like it was kind of a funny troll to put out there so I decided to let you guys do the same if you want, who knows, maybe someone can do it on a bigger scale than I did A bit of a background about this so you have some kind of understanding. I have set up a backend listener that will listen to the sockets coming in and the Twitter API is accessed through the backend only because OSBot blocks it for some reason. The host is the IP of a server that I have and this is the only thing that will be running on that server. Don't change the IP/Port if you want to access it through my backend. Twitter has some rules about using their API and there is some information on how to get your API/Access Keys and Tokens on the website. You should read this before using the code. Underneath is the src to the front-end that you'd need to implement into your scripts or anything else for that matter if you wanted to use it. Example usage: public static void main(String[] args) { final Twitter twitter = new Twitter(); twitter.setTwitterKeys("", ""); twitter.setTwitterTokens("", ""); System.out.println(twitter.sendTweetRequest("TEST")); } Twitter Class: package main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; public class Twitter { private String apiKey; private String secretKey; private String secretToken; private String accessToken; private String host = "62.171.157.14"; private int port = 42069; public void setTwitterKeys(final String apiKey, final String secretKey) { this.apiKey = apiKey; this.secretKey = secretKey; } public void setTwitterTokens(final String accessToken, final String secretToken) { this.secretToken = secretToken; this.accessToken = accessToken; } public void setSocketDestination(final String host, final int port) { this.host = host; this.port = port; } public String sendTweetRequest(final String content) { String resp = null; if (isInfoNull()) { System.out.println("Info is null..set the required info before continuing..."); } else { try { Socket socket = new Socket(host, port); PrintWriter out = new PrintWriter(socket.getOutputStream()); out.println(apiKey + "--" + secretKey + "--" + accessToken + "--" + secretToken + "--" + content + "--"); out.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); resp = in.readLine(); socket.close(); } catch (IOException e) { e.printStackTrace(); } } return resp; } private boolean isInfoNull() { return apiKey == null || secretKey == null || accessToken == null || secretToken == null || host == null || port == -1; } }
×
×
  • Create New...