Media Log

네이버 로그인:
public static bool NaverLogin(string ID, string PW, CookieContainer cookie)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://nid.naver.com/nidlogin.login");
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.Referer = "https://nid.naver.com/nidlogin.login";
    request.CookieContainer = cookie;

    StreamWriter swriter = new StreamWriter(request.GetRequestStream());
    swriter.Write("enctp=2&svctype=0&id=" + ID + "&pw=" + PW);
    swriter.Close();

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response.StatusCode == HttpStatusCode.OK)
    {
        Stream resStream = response.GetResponseStream();
        StreamReader readStream = new StreamReader(resStream, Encoding.Default);
        string result = readStream.ReadToEnd();

        resStream.Close();
        readStream.Close();
        if (result.IndexOf("http://static.nid.naver.com/sso/cross-domain.nhn") >= 0)
            return true;
    }
    return false;
}
네이버 쪽지 전송:
public static bool NaverMessage(string to, string body, CookieContainer cookie)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://m.note.naver.com/mobile/mobileCaptchaViewCheck.nhn?");
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.Referer = "http://m.note.naver.com/mobile/mobileSendNoteForm.nhn?returnUrl=http%3a%2f%2fm.note.naver.com%2fmobile%2fmobileReceiveList.nhn";
    request.CookieContainer = cookie;

    StreamWriter swriter = new StreamWriter(request.GetRequestStream());
    swriter.Write("fromUrl=%2Fmobile%2FmobileSendNoteForm.nhn%3FselfSend%3D0&returnUrl=http%3A%2F%2Fm.note.naver.com%2Fmobile%2FmobileReceiveList.nhn&svcType=0&svcId=&svcName=&svcTitle=&svcLink=¬e=" + System.Web.HttpUtility.UrlEncode(body, Encoding.Default) + "&targetId=" + to + "&isBackup=true&isReplyNote=false");
    swriter.Close();

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response.StatusCode == HttpStatusCode.OK)
    {
        Stream resStream = response.GetResponseStream();
        StreamReader readStream = new StreamReader(resStream, Encoding.UTF8);
        string result = readStream.ReadToEnd();

        resStream.Close();
        readStream.Close();
        if (result.IndexOf("성공") >= 0)
            return true;
    }
    return false;
}

네이버 메일 전송:

public static bool NaverMail(string id, string senderName, string to, string subject, string body, CookieContainer cookie)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://mail.naver.com/json/write/send/");
    request.Method = "POST";
    request.ContentType = "application/x-www-form-urlencoded";
    request.Referer = "http://mail.naver.com/";
    request.CookieContainer = cookie;

    StreamWriter swriter = new StreamWriter(request.GetRequestStream());
    swriter.Write("senderName=" + senderName + "&to=" + to + "&cc=&bcc=&subject=" + subject + "&body=" + body + "&contentType=html&charset=AUTO&sendSeparately=false&saveSentBox=true&type=new&fromMe=0&attachID=tseCWrwm_LYmKoumKSevFou97qUm7riGWzwCMBKTM40nWzJCbqMZKAEwKou.&reserveDate=&reserveGMT=&reserveTime=&calendarVal=&autoSaveMailSN=&addReceiverAddress=false&attachCount=0&attachSize=0&bigfile=&sessionID=&seqNums=&priority=0&ndriveFileInfos=&lists=&serviceID=&u=" + id);
    swriter.Close();

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response.StatusCode == HttpStatusCode.OK)
    {
        Stream resStream = response.GetResponseStream();
        StreamReader readStream = new StreamReader(resStream, Encoding.UTF8);
        string result = readStream.ReadToEnd();

        resStream.Close();
        readStream.Close();
        if (result.IndexOf("성공") >= 0)
            return true;
    }
    return false;
}


저작자 표시
신고
  1. 안녕하세요 ^^ at 2012.12.07 16:37 신고 [edit/del]

    네이버 자동 로그인, 네이버 자동 메일, 쪽지 또는 뎃글 달기 등을 할 수 있겠군요... 하려면 패킷 분석으로 접근 하신건가요? 어떠한 사고 방식을 통해 위와 같은 결과를 도출 하셨느지 너무 궁금하네요...^^ 완전 부럽 부럽ㅠㅠ 공부하는 1인 입니다.

    Reply
    • BlogIcon EXYNOA at 2012.12.07 20:01 신고 [edit/del]

      패킷 분석 맞습니다. HTTP 아날라이져 혹은, 파이어 폭스의 부가기능인 httpfox로도 확인할 수 있습니다. 스마트 스니퍼같은 스니퍼 프로그램도 물론 가능합니다.

  2. at 2013.01.08 21:58 [edit/del]

    비밀댓글입니다

    Reply
  3. at 2013.03.22 02:10 [edit/del]

    비밀댓글입니다

    Reply
  4. at 2013.09.07 21:42 [edit/del]

    비밀댓글입니다

    Reply
  5. 궁급합니다,! at 2015.11.29 03:36 신고 [edit/del]

    네이버 로그인시 인자 값으로 쿠키는 어떻게 하는건가요 ??
    어떻게 쿠키 값을 가져오지요 ?

    Reply
  6. at 2016.11.18 00:23 [edit/del]

    비밀댓글입니다

    Reply

submit

티스토리 툴바