[지저분한] 네이버 자동출첵 Perl script

acidd15의 이미지

#!/usr/bin/perl

use Socket;
use POSIX;

sub parseURL{

  my $url=@_[0];

  return $url=~m/(https?):\/\/([^\/]*)(.*)/;


}

#클럽아이디
$club_id="";

#날짜 세팅
$start_day=7;
$start_mon=6;
$start_year=2005;

#메시지
$what_say="흠....-_-.";

#id 에 아이디
#pw 에 패스워드
$n_id="";
$n_pw="";

$page_url="http://id.naver.com/nidlogin.login?id=".$n_id."&pw=".$n_pw;
$view_url="http://cafe.naver.com/AttendanceView.nhn?clubid=".$club_id."&attendyear=".$start_year."&attendmonth=".sprintf("%02d",$start_mon)."&attendday=".sprintf("%02d",$start_day);
$post_url="http://cafe.naver.com/AttendancePost.nhn?clubid=".$club_id."&attendyear=".$start_year."&attendmonth=".sprintf("%02d",$start_mon)."&attendday=".sprintf("%02d",$start_day)."&page=&emotion=11&content=".$what_say;

print $page_url."\n";
print $view_url."\n";
print $post_url."\n";

($protocol,$host,$uri)=parseURL($page_url);

if($protocol eq "http"){

  $port="80";

}elsif($protocol eq "https"){

  $port="443";

}else{

  print "Unknown protocol.\n";
  exit 0;

}

$port = getservbyname ($port, 'tcp') unless $port =~ /^\d+$/;
$dest_ip = gethostbyname ($host);
$dest_serv_params  = sockaddr_in($port, $dest_ip);

socket  (S, &AF_INET, &SOCK_STREAM, 0)  or die "socket: $!";
connect (S, $dest_serv_params)          or die "connect: $!";
select  (S); $| = 1; select (STDOUT);   # Eliminate STDIO buffering

$msg="GET ".$uri." HTTP/1.1\r\nConnection: Close\r\nHost: ".$host."\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n\r\n";

syswrite(S,$msg,length($msg));

$content="";
while(($len=sysread(S,$read_buffer,256)>0)){
  $content.=$read_buffer;
}

close S;

#print $content."\n";

@list=split(/\r\n/,$content);
@cookie_arr=();

for $i(0..@list-1){

  if($list[$i]=~/Set\-Cookie:\s*(.+)/g){

    push(@cookie_arr,$1);

  }

}

$cookie_str="Cookie: ".join(" ",@cookie_arr)."\r\n";

print $cookie_str."\n";

$dest_date=scalar(mktime(0,0,0,$start_day,$start_mon-1,$start_year-1900));

print $dest_date." : ".localtime($dest_date)."\n";

$loop_triger=0;
$count=0;
while(!$loop_triger){

  if($dest_date<=time or $count==60){

    $count=0;

    print time."\n";
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
    printf "%4d-%02d-%02d %02d:%02d:%02d\n",$year+1900,$mon+1,$mday,$hour,$min,$sec;

    print $dest_date." : ".localtime($dest_date)."\n";

    #글쓰기 페이지에 연결하여 textarea가 존재하는지 살핀다.
    ($protocol,$host,$uri)=parseURL($view_url);

    if($protocol eq "http"){

      $port="80";

    }elsif($protocol eq "https"){

      $port="443";

    }else{

      print "Unknown protocol.\n";
      exit 0;

    }

    $port = getservbyname ($port, 'tcp') unless $port =~ /^\d+$/;
    $dest_ip = gethostbyname ($host);
    $dest_serv_params  = sockaddr_in($port, $dest_ip);

    socket  (S, &AF_INET, &SOCK_STREAM, 0)  or die "socket: $!";
    connect (S, $dest_serv_params)          or die "connect: $!";
    select  (S); $| = 1; select (STDOUT);   # Eliminate STDIO buffering

    $msg="GET ".$uri." HTTP/1.1\r\n".$cookie_str."Connection: Close\r\nHost: ".$host."\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n\r\n";

    syswrite(S,$msg,length($msg));

    $content="";
    while(($len=sysread(S,$read_buffer,256)>0)){
      $content.=$read_buffer;
    }

    close S;

    if($content=~/ui\('$n_id'/){

      print "Already wroted.\n";
      #exit 0;
      ++$start_day;

      $dest_date=scalar(mktime(0,0,0,$start_day,$start_mon-1,$start_year-1900));

      $view_url="http://cafe.naver.com/AttendanceView.nhn?clubid=".$club_id."&attendyear=".$start_year."&attendmonth=".sprintf("%02d",$start_mon)."&attendday=".sprintf("%02d",$start_day);
      $post_url="http://cafe.naver.com/AttendancePost.nhn?clubid=".$club_id."&attendyear=".$start_year."&attendmonth=".sprintf("%02d",$start_mon)."&attendday=".sprintf("%02d",$start_day)."&page=&emotion=11&content=".$what_say;

      print $page_url."\n";
      print $view_url."\n";
      print $post_url."\n";

    }else{

      #존재 한다면 글을 쓰고 프로그램을 종료한다.

      if($content=~/<form name="attendanceFrm"/){

        print "OK! I FOUND IT!!!\n";

        $delay_time=int(rand(6))+2;
        print "DELAY: ".$delay_time."\n";

        sleep($delay_time);

        ($protocol,$host,$uri)=parseURL($post_url);

        if($protocol eq "http"){

          $port="80";

        }elsif($protocol eq "https"){

          $port="443";

        }else{

          print "Unknown protocol.\n";
          exit 0;

        }

        $port = getservbyname ($port, 'tcp') unless $port =~ /^\d+$/;
        $dest_ip = gethostbyname ($host);
        $dest_serv_params  = sockaddr_in($port, $dest_ip);

        socket  (S, &AF_INET, &SOCK_STREAM, 0)  or die "socket: $!";
        connect (S, $dest_serv_params)          or die "connect: $!";
        select  (S); $| = 1; select (STDOUT);   # Eliminate STDIO buffering

        $msg="GET ".$uri." HTTP/1.1\r\n".$cookie_str."Connection: Close\r\nHost: ".$host."\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n\r\n";

        syswrite(S,$msg,length($msg));

        $content="";
        while(($len=sysread(S,$read_buffer,256)>0)){
          $content.=$read_buffer;
        }

        close S;

        print $content;

        #exit 0;

      }

    }

  }

  sleep(1);

  ++$count;

}

저번달에 제가 가입되었던 스터디 클럽에서 출첵 미션하길래 만들어 봤습니다.ㅋ..덕분에 출첵미션 성공해서 상품도 타고 했는데..--;;

급조돼서 좀 지저분 합니다..필요하신분들은 다듬어서 쓰십시요 ^^;

Forums: 
shamlock의 이미지

출첵?이 먼지 몰라서 ㅎㅎ

@.@

익명 사용자의 이미지

^^..카페 출석부 입니다..ㅋ

익명 사용자의 이미지

#!/bin/bash
clubid=클럽ID(숫자로 된거 ^^)
year=2005
month=07
date=06
personaconid=퍼스나콘ID(그.. 아이디 앞에 쪼만한 그림)
content=출첵!
id=아이디
pw=비번
url="http://id.naver.com/nidlogin.login?id=$id&pw=$pw&url=http%3A%2F%2Fcafe.naver.com%2FAttendancePost.nhn%3Fclubid%3D$clubid%26attendyear%3D$year%26attendmon
th%3D$month%26attendday%3D$date%26page%3D%26emoticon%3D$personaconid%26content%3D$content"

lynx -accept_all_cookies $url
익명 사용자의 이미지

pistos wrote:
#!/bin/bash
clubid=클럽ID(숫자로 된거 ^^)
year=2005
month=07
date=06
personaconid=퍼스나콘ID(그.. 아이디 앞에 쪼만한 그림)
content=출첵!
id=아이디
pw=비번
url="http://id.naver.com/nidlogin.login?id=$id&pw=$pw&url=http%3A%2F%2Fcafe.naver.com%2FAttendancePost.nhn%3Fclubid%3D$clubid%26attendyear%3D$year%26attendmon
th%3D$month%26attendday%3D$date%26page%3D%26emoticon%3D$personaconid%26content%3D$content"

lynx -accept_all_cookies $url

오호...물론 원하는 날짜에 출첵을 남길수는 있겠지만 남긴 시간이 맞지 않을수도 있을 것이기 때문에 약간은 아쉬운 스크립트 이군요. :lol:

왜냐? 현재보다 미래나 과거의 어느 특정날짜에 출첵을 할경우 시간은 현재시간으로 남겨지기때문에 출첵을 해도 신뢰성이 없겠죠.. 8)

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.