Чаты Userid в чатах народа

Discussion in 'Веб-уязвимости' started by Guest, 17 Sep 2004.

  1. Guest

    Guest Guest

    Reputations:
    0
    вот сам скрипт (narod_chat.js)

    var script = "http://narod.yandex.ru/cgi-bin/GetCom";
    var optionurl = "http://narod.yandex.ru/chat/chat_enter.xhtml?mychat_id=0&CF_Chat=";

    var cid = 0;
    var uid = 0;
    var status = 0;

    var MessageCount = 40;
    var RefreshTime = 15;
    var Status = 0;


    var text =new Array();
    var GetOk = true;
    var MesBuf = "";
    var toid = 0;
    var OptionsSet = false;
    //--------------------------------------------------------------------------
    function Options(){
    OptionsSet = true;
                   Exit();
    return false;
    }
    //--------------------------------------------------------------------------
    function Refresh(){
    send_command(3, 0);
    return false;
    }
    //--------------------------------------------------------------------------
    function ChatStart(){
    cid = get_val("chatid");
    uid = get_val("userid");
    send_command(0, "");
    }

    //--------------------------------------------------------------------------
    function Exit(){
    send_command(1, "");
    return false;
    }

    //--------------------------------------------------------------------------
    function SendMessage(){
    Data = top.document.ChatForm.Message.value;
    if(Data != ""){
    if(top.MesBuf == ""){
    if(GetOk){
    send_command(2, Data);
    top.document.ChatForm.Message.value = "";
    }else{
    top.MesBuf = Data;
    }
    }
    }
    return false;
    }
    //----------------------------------------------------------------------
    function add_nick_to_message (nick)
    {
    var s =" " + nick;
    if(top.document.ChatForm.Message !="undefined")
    top.document.ChatForm.Message.value += s;

    setTimeout("focus_messager()",200);

    return false;

    }

    //============================================
    function SetUserList(ulist, culist, nulist){
    var s, ends, elforma;
    if(Status == 2){
    s = "<form action=\"http://narod.yandex.ru/chat/shtraf.xhtml\"  METHOD=\"get\" name='userlist' target='_top'>";
    s += "<INPUT Type=hidden name=userid value="+uid+">";
    s += "<INPUT Type=hidden name=chatid value="+cid+">";
    s += "<INPUT Type=hidden name=backurl value="+top.document.URL+">";

    ends = "<BR><INPUT TYPE=SUBMIT name=deluser value=\"Удалить\"> "
    +"<INPUT TYPE=SUBMIT name=\"shtrafuser\" value=\"Штраф\">"
    +"</form>";
    }else{
    s = "";
    ends = "";
    }

    for(i=0; i< ulist.length; i++){
    if(ulist != "undefined"){
    if (Status==2) s+="<INPUT TYPE=\"Checkbox\" NAME=\"DelList[]\" VALUE=\""+nulist+"\">";
                                   else s +="<LI style=color:"+culist+">";
    s += "<a style=\"text-decoration: none\" href='' onclick=\" return top.add_nick_to_message(\'"+ulist+": \&#39[​IMG]\"><FONT color="+culist+">";
    s += ulist+"</FONT></a>";
    if(Status == 2) s+="<BR>";
    }
    }
    top.Chat_UserList.document.body.innerHTML = s+ends;
    focus_messager();
    return false;
    }

    //--------------------------------------------------------------------------

    function SM(){
    if(top.MesBuf != ""){
    send_command(2, top.MesBuf);
    top.MesBuf = "";
    top.document.ChatForm.Message.value = "";
    }
    return 0;
    }

    //--------------------------------------------------------------------------
    function AddMessage(Data){
    for(i = Data.length-1; i>= 0; i--){
    Message = Data.split("<Q>");
    if (Message[1].substring(0,4)=="<QA>") {
    Message[1]=Message[1].substring(4);
    adm="<i>";
    admc="</i>";
    }else {
    adm="<b>";
    admc="</b>";
    }

    text[text.length] = "<font size=3 color=#808080>"+Message[0]+" </font><a style=\"text-decoration: none\" href='' onclick=\" return top.add_nick_to_message(\'"+Message[1]+": \&#39[​IMG]\"><font size=3 color=black>"+adm+Message[1]+": "+admc+"</font></a><a style=\"text-decoration: none\" href='' onclick=\"return top.add_nick_to_message(\'"+Message[3]+" \&#39[​IMG];\"><font size=3 color="+Message[2]+" >"+Message[3]+"</font> </a>\r\n";
    }

    if(text.length >= MessageCount){
    text.reverse();
    text.length = MessageCount;
    text.reverse();
    }
    //---  ---

    if(Data.length > 0){
    top.Chat_Messages.document.body.innerHTML = text.join("<br>");
    top.Chat_Messages.scrollBy(0,65534);
    top.Chat_Messages.scrollBy(0,65534);
    }

    // focus_messager();
    return false;
    }
    //--------------------------------------------------------------------------
    function unauthorize(){
    clearTimeout(toid);
    if(top.SDMess){
    top.document.location = top.SDMess;
    }
    else if(top.unAuthorize){
    top.unAuthorize();
    }
    else{
    top.document.location = "http://narod.yandex.ru/chat/error.xhtml";
    // str = document.URL;
    // top.document.location = str.substring(0, str.indexOf("/", 8)+1);
    }

    return true;
    }
    //--------------------------------------------------------------------------
    function logout(chatid){
    clearTimeout(toid);
    top.Chat_Messages.document.body.innerHTML = "";
    top.Chat_UserList.document.body.innerHTML = "";
                   
    if(top.Logout){
    top.Logout();
    }
    else{
    if (top.OptionsSet) {
    top.document.location=optionurl+chatid+"&random_nocache="+Math.random();
    } else {
    if (top.chat_ref)
    top.document.location = top.chat_ref;
    else {
        str = document.URL;
    top.document.location = str.substring(0, str.indexOf("/", 8)+1);
    }
    }
    }
    return true;
    }

    //============================================
    function get_val(name){
    var end;
    var s = document.URL;
    var start = s.indexOf(name+"=");
    if(start != -1){
    start += name.length+1;
    if(!(end = s.indexOf("&", start)+1)) end = s.length+1;
    return s.substring(start, end-1);
    }
    return "";
    }
    //--------------------------------------------------------------------------
    function send_command(command, data){
    clearTimeout(toid);
    if(GetOk){
    GetOk = false;
    data= escape(data);
                           top.Chat_Command.document.location = script+"?chatid="+cid+"&userid="+uid+"&command="+command+"&data="+data+"&wrapper=1&new="+Math.round(Math.random(100)*100000);
    }
    if(RefreshTime != 0) toid = setTimeout("send_command(3,0)", RefreshTime*1000);
    }
    //--------------------------------------------------------------------------
    function focus_messager()
    {
    if (top.Foc) {
    if (top.document.ChatForm.Message != "undefined")
    top.document.ChatForm.Message.focus();
    }
    }
    //--------------------------------------------------------------------------
    function Init(iLines, iStatus, iRefresh){
    MessageCount = iLines;
    RefreshTime = iRefresh;
    Status = iStatus;
                   if (Status == 2) top.document.getElementById("ah").innerHTML = "  <a href=/help/10.html target=popuphelp onclick='window.open(\"/help/10.html\", \"popuphelp\",\"alwaysRaised=yes,dependent=no,resizable=yes,height=250,width=500\");return false;'><img src=/pics/m16.gif width=11 height=11 border=0></a>";
    }
    //--------------------------------------------------------------------------
    function shtraf(chatid){
    top.SDMess = "http://narod.yandex.ru/chat/error.xhtml?Shtraf=1&chatid="+chatid;
    }
    //--------------------------------------------------------------------------
    function rshtraf(chatid){
    top.SDMess = "http://narod.yandex.ru/chat/error.xhtml?Shtraf=2&chatid="+chatid;
    }
    //============================================



    у меня вопрос как скрипт генерит userid
     
  2. zFailure

    zFailure Elder - Старейшина

    Joined:
    6 Jun 2004
    Messages:
    163
    Likes Received:
    24
    Reputations:
    24
    всю жизнь думал что userid генирится на сервере
     
  3. DamneD

    DamneD Banned

    Joined:
    4 Jun 2004
    Messages:
    87
    Likes Received:
    0
    Reputations:
    0
    ...и был прав [​IMG]
     
  4. ntking

    ntking New Member

    Joined:
    12 Jun 2004
    Messages:
    17
    Likes Received:
    0
    Reputations:
    0
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Цитата </td></tr><tr><td id="QUOTE">у меня вопрос как скрипт генерит userid[/QUOTE]<span id='postcolor'>
    да стопудова рандомом с занесением в лог чата.

    А зачем тебе?

    P.S. На скрипт можешь не смотреть, нет там подсказки[​IMG] [​IMG]