日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

对于58同城自动登陆的补充【主要是代码】

發布時間:2025/3/21 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 对于58同城自动登陆的补充【主要是代码】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://blog.csdn.net/silence1214/article/details/6694373

http://blog.csdn.net/silence1214/article/details/6659742

?

看到有朋友回復評論不知道如何利用上一篇我的寫的58同城的登陸,我在這里把代碼給大家看下吧,我封裝好的工具類:我的操作思路是這樣子的。因為我是在winform里面坐的程序,之前沒有用WebBrowser組件,一直用的HttpWebrequest,但是這個js的話,只有利用webBrowser來進行了。大體思路就是1:用WebBrowser來加載這個js,這個js我下載到了本地2:根據對應的函數來進行調用。

[csharp] view plaincopyprint?
  • using?System;??
  • using?System.Collections.Generic;??
  • using?System.Text;??
  • using?System.Windows.Forms;??
  • ??
  • namespace?PostApplication.core.util??
  • {??
  • ????///?<summary> ??
  • ????///?58.com的post工具類的工具類 ??
  • ????///?通過加載js文件獲得對前端密碼的處理 ??
  • ????///?</summary> ??
  • ????class?Post58comUtil??
  • ????{??
  • ????????String?filePath?=?AppDomain.CurrentDomain.BaseDirectory?+?@"file\cd58.html";??
  • ??????????
  • ????????private?String?password;?//?需要進行處理的密碼 ??
  • ????????private?long?timesign;??
  • ????????public?Post58comUtil(String?password,?long?timesign)??
  • ????????{??
  • ????????????this.password?=?password;??
  • ????????????this.timesign?=?timesign;??
  • ????????}??
  • ??
  • ????????///?<summary> ??
  • ????????///?初始化時間戳 ??
  • ????????///?</summary> ??
  • ????????private?void?InitializeTimesign()??
  • ????????{??
  • ????????????DateTime?d1?=?DateTime.Now.AddHours((double)(-8));??
  • ????????????DateTime?d2?=?new?DateTime(1970,?1,?1);??
  • ????????????long?d?=?(long)d1.Subtract(d2).TotalMilliseconds;??
  • ????????????this.timesign?=?d;??
  • ????????}??
  • ??
  • ??
  • ????????public?delegate?String?getm32strDelegate();??
  • ????????public?String?get32strOri()??
  • ????????{??
  • ????????????object?obj?=?MainForm.browser.Document.InvokeScript("getm32str",?new?object[]?{?password,?timesign?+?""});??
  • ????????????return?obj?+?"";??
  • ????????}??
  • ????????///?<summary> ??
  • ????????///?32str加密 ??
  • ????????///?</summary> ??
  • ????????///?<returns></returns> ??
  • ????????public?String?getm32str()??
  • ????????{??
  • ????????????if?(MainForm.browser.InvokeRequired)??
  • ????????????{??
  • ????????????????getm32strDelegate?g?=?new?getm32strDelegate(get32strOri);??
  • ????????????????object?obj?=?MainForm.browser.Invoke(g);??
  • ????????????????return?obj?+?"";??
  • ????????????}??
  • ????????????else??
  • ????????????{??
  • ????????????????return?get32strOri();??
  • ????????????}??
  • ????????}??
  • ??
  • ??
  • ????????public?delegate?String?getm16strDelegate();??
  • ????????public?String?get16strOri()??
  • ????????{??
  • ????????????object?obj?=?MainForm.browser.Document.InvokeScript("getm16str",?new?object[]?{?password,?timesign?+?""?});??
  • ????????????return?obj?+?"";??
  • ????????}??
  • ????????///?<summary> ??
  • ????????///?16str加密 ??
  • ????????///?</summary> ??
  • ????????///?<returns></returns> ??
  • ????????public?String?getm16str()??
  • ????????{??
  • ????????????if?(MainForm.browser.InvokeRequired)??
  • ????????????{??
  • ????????????????getm16strDelegate?g?=?new?getm16strDelegate(get16strOri);??
  • ????????????????object?obj?=?MainForm.browser.Invoke(g);??
  • ????????????????return?obj?+?"";??
  • ????????????}??
  • ????????????else??
  • ????????????{??
  • ????????????????return?get16strOri();??
  • ????????????}??
  • ????????}??
  • ??
  • ????????
  • ??
  • ????}??
  • }??
  • ?

    using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms;namespace PostApplication.core.util {/// <summary>/// 58.com的post工具類的工具類/// 通過加載js文件獲得對前端密碼的處理/// </summary>class Post58comUtil{String filePath = AppDomain.CurrentDomain.BaseDirectory + @"file\cd58.html";private String password; // 需要進行處理的密碼private long timesign;public Post58comUtil(String password, long timesign){this.password = password;this.timesign = timesign;}/// <summary>/// 初始化時間戳/// </summary>private void InitializeTimesign(){DateTime d1 = DateTime.Now.AddHours((double)(-8));DateTime d2 = new DateTime(1970, 1, 1);long d = (long)d1.Subtract(d2).TotalMilliseconds;this.timesign = d;}public delegate String getm32strDelegate();public String get32strOri(){object obj = MainForm.browser.Document.InvokeScript("getm32str", new object[] { password, timesign + ""});return obj + "";}/// <summary>/// 32str加密/// </summary>/// <returns></returns>public String getm32str(){if (MainForm.browser.InvokeRequired){getm32strDelegate g = new getm32strDelegate(get32strOri);object obj = MainForm.browser.Invoke(g);return obj + "";}else{return get32strOri();}}public delegate String getm16strDelegate();public String get16strOri(){object obj = MainForm.browser.Document.InvokeScript("getm16str", new object[] { password, timesign + "" });return obj + "";}/// <summary>/// 16str加密/// </summary>/// <returns></returns>public String getm16str(){if (MainForm.browser.InvokeRequired){getm16strDelegate g = new getm16strDelegate(get16strOri);object obj = MainForm.browser.Invoke(g);return obj + "";}else{return get16strOri();}}} }



    調用方法:

    ?

    ?

    [csharp] view plaincopyprint?
  • //?獲取時間戳 ??
  • ????????????DateTime?d1?=?DateTime.Now.AddHours((double)(-8));??
  • ????????????DateTime?d2?=?new?DateTime(1970,?1,?1);??
  • ????????????long?d?=?(long)d1.Subtract(d2).TotalMilliseconds;??
  • ??
  • ????????????Post58comUtil?util?=?new?Post58comUtil(loginUserPassword,?d);??
  • ?

    // 獲取時間戳DateTime d1 = DateTime.Now.AddHours((double)(-8));DateTime d2 = new DateTime(1970, 1, 1);long d = (long)d1.Subtract(d2).TotalMilliseconds;Post58comUtil util = new Post58comUtil(loginUserPassword, d);


    那么16str和32str都可以調用了。。
    ?

    ?

    轉載于:https://www.cnblogs.com/l1b2q31/articles/2767273.html

    總結

    以上是生活随笔為你收集整理的对于58同城自动登陆的补充【主要是代码】的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。