`
knight_black_bob
  • 浏览: 823154 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

wareshake 破解公司打卡 问题

    博客分类:
  • java
阅读更多

1.

分享一个无线网用于手机端接受

 

network.bat 

netsh wlan set hostednetwork mode=allow  

netsh wlan set hostednetwork ssid=baoyou  

netsh wlan set hostednetwork key=12345678 keyUsage=persistent  

netsh wlan start hostednetwork  

 

电脑 分享 一个 无限网络 给 手机

 

 

2.点击app 中的打卡 上班 下班

获取 提交 url  和 params

 



 

 

3.写个 定时任务 自动打卡

 

package java2015.java09;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import net.sf.json.JSONObject;

public class HttpPost
{
  public static final long PERIOD_DAY = 86400000L;
  public static final String URL = "http://x.xx.xx.xx:8095/fieldwork/attendRecord/dev/attendance";

  public static String post(byte[] params, String url)
  {
    try
    {
      if (url == null) {
        return null;
      }
      URL send_url = new URL(url);
      Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.cmcc", 8080));
      HttpURLConnection conn = null;
      if (OsUtil.isWindows())
        conn = (HttpURLConnection)send_url.openConnection(proxy);
      else {
        conn = (HttpURLConnection)send_url.openConnection();
      }
      conn.setConnectTimeout(10000);
      conn.setDoOutput(true);
      conn.setUseCaches(false);
      conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
      conn.setRequestMethod("POST");

      conn.connect();
      OutputStream out = conn.getOutputStream();
      out.write(params);
      out.flush();
      out.close();
      InputStream in = conn.getInputStream();
      ByteArrayOutputStream temp = new ByteArrayOutputStream();
      for (byte[] bytes = new byte[1]; in.read(bytes) != -1; temp.write(bytes));
      in.close();
      return new String(temp.toByteArray());
    }
    catch (MalformedURLException e)
    {
      e.printStackTrace();
    }
    catch (IOException e) {
      e.printStackTrace();
    }
    return null;
  }

  public static String post(JSONObject json, String url)
  {
    byte[] params = null;
    try {
      params = json.toString().getBytes("UTF-8");
    }
    catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    return post(params, url);
  }

  public static void main(String[] args) throws Exception
  {
    ScheduledExecutorService service = Executors.newScheduledThreadPool(2);
    service.scheduleAtFixedRate(
      new Runnable()
    {
      public void run() {
        for (int j = 100; j < 200; j++)
          try {
            System.out.println(HttpPost.post(HttpPost.GoToWork(j).toString().getBytes("utf-8"), "http://xxx.xxx.xxx.xxx:8095/fieldwork/attendRecord/dev/attendance"));
          } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
          }
      }
    }
    , GoToWorkDelay(), 86400000L, TimeUnit.MILLISECONDS);
    service.scheduleAtFixedRate(new Runnable()
    {
      public void run() {
        for (int j = 100; j < 200; j++)
          try {
            HttpPost.post(HttpPost.GoOffWork(j).toString().getBytes("utf-8"), "http://xxxxxxxxxx/fieldwork/attendRecord/dev/attendance");
          } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
          }
      }
    }
    , GoOffWorkDelay(), 86400000L, TimeUnit.MILLISECONDS);
  }

  public static String GoToWork(int empId)
  {
    return getRequestJson(empId, 0);
  }

  public static String GoOffWork(int empId) {
    return getRequestJson(empId, 1);
  }

  public static String getRequestJson(int empId, int working) {
    return "{\"latY\":39.903276385462654,\"shiftDetailId\":\"0\",\"attendPhoto\":\"\",\"type\":\"" + working + "\",\"lngX\":116.35748400254391,\"userId\":\"" + empId + "\",\"addressName\":\"\"}";
  }

  public static long GoToWorkDelay() throws Exception
  {
    return getDeLay("09:00:00");
  }

  public static long GoOffWorkDelay() throws Exception {
    return getDeLay("18:00:00");
  }

  public static long getDeLay(String dataFormatString) throws Exception {
    DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    DateFormat fmt2 = new SimpleDateFormat("yyyy-MM-dd");
    long tommorrow = new Date().getTime() + 86400000L;
    String nextDate = fmt2.format(new Date(tommorrow));
    nextDate = nextDate + " " + dataFormatString;
    Date nextD = fmt.parse(nextDate);
    long delay = nextD.getTime() - new Date().getTime();
    if (OsUtil.isWindows()) {
      delay -= 86400000L;
    }
    return delay;
  }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

  • 大小: 91.9 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics