Tuesday 7 July 2015

FPC/Lazarus Telnet client For FlightGear (using Synapse).


This software is not in  production status , it's just a sample and may be subject for further development !
Recently , I searched the internet for an example of telnet client written in FPC ,
(that's my way to do things, search for the sample and improve it ) , I used the synapse library
many times for my network based applications , but for a telnet application ,there are few examples and no one worked for me . so I tried to fix one of them and share  the working example with the wide community of FPC/ Lazarus or Delphi users .
The example is originally extracted from the Lazarus wiki pages,  and especially made to work with the FlightGear internal Telnet server ,


The client interface is fully designed for Flightgear server but it can be used with any Telnet server you want , and (of course )you can edit it to fit your needs .
Again, Note that it uses the telnetsshclient unit Here is the client code :

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls, telnetsshclient;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button_Connect: TButton;
    Button_SendCmd: TButton;
    Edit_Port: TEdit;
    Edit_Cmd: TEdit;
    Edit_HostIP: TEdit;
    Image1: TImage;
    Label_FG: TLabel;
    Label_Port: TLabel;
    Label_Cmd: TLabel;
    Label_Log: TLabel;
    LabelHost: TLabel;
    Memo_Log: TMemo;
    StaticText1: TStaticText;
    procedure Button_ConnectClick(Sender: TObject);
    procedure Button_SendCmdClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;
  comm: TTelnetSSHClient;
  Command: string;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button_ConnectClick(Sender: TObject);
begin
  comm:=TTelnetSSHClient.Create;
  comm.HostName:= Edit_HostIP.Text;
  if comm.HostName='' then
  begin
    ShowMessage('Please specify hostname .');
    exit;
  end;
  comm.TargetPort:= Edit_Port.Text;
  if comm.TargetPort ='' then
  begin
    ShowMessage('Please specify target port .');
    exit;
  end;
  comm.ProtocolType:=Telnet;
  Memo_Log.Append('connecting ..' + comm.Connect);
  if comm.Connected then
  begin
    Memo_Log.Append('Connected :)');
    Memo_Log.Append('Server: ' + comm.HostName + ':'+comm.TargetPort);

  end;unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls, telnetsshclient;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button_Connect: TButton;
    Button_SendCmd: TButton;
    Edit_Port: TEdit;
    Edit_Cmd: TEdit;
    Edit_HostIP: TEdit;
    Image1: TImage;
    Label_FG: TLabel;
    Label_Port: TLabel;
    Label_Cmd: TLabel;
    Label_Log: TLabel;
    LabelHost: TLabel;
    Memo_Log: TMemo;
    StaticText1: TStaticText;
    procedure Button_ConnectClick(Sender: TObject);
    procedure Button_SendCmdClick(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;
  comm: TTelnetSSHClient;
  Command: string;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button_ConnectClick(Sender: TObject);
begin
  comm:=TTelnetSSHClient.Create;
  comm.HostName:= Edit_HostIP.Text;
  if comm.HostName='' then
  begin
    ShowMessage('Please specify hostname .');
    exit;
  end;
  comm.TargetPort:= Edit_Port.Text;
  if comm.TargetPort ='' then
  begin
    ShowMessage('Please specify target port .');
    exit;
  end;
  comm.ProtocolType:=Telnet;
  Memo_Log.Append('connecting ..' + comm.Connect);
  if comm.Connected then
  begin
    Memo_Log.Append('Connected :)');
    Memo_Log.Append('Server: ' + comm.HostName + ':'+comm.TargetPort);

  end;

end;

procedure TForm1.Button_SendCmdClick(Sender: TObject);
begin
  Command:= Edit_Cmd.Text+ #10 + #13;
  Memo_Log.Append('*** Sending ' + Command);
  Memo_Log.Append('*** Begin result****');
  Memo_Log.Append(comm.CommandResult(Command));
  Memo_Log.Append('*** End result****');
  Memo_Log.Append('');

end;

end.

end;

procedure TForm1.Button_SendCmdClick(Sender: TObject);
begin
  Command:= Edit_Cmd.Text+ #10 + #13;
  Memo_Log.Append('*** Sending ' + Command);
  Memo_Log.Append('*** Begin result****');
  Memo_Log.Append(comm.CommandResult(Command));  // Here we send the command via our socket .
  Memo_Log.Append('*** End result****');
  Memo_Log.Append('');

end;

end.


Download :  the only currently compiled version is a 64 bit executable for Linux based systems (Download here ), for other systems you can download the source and
compile to your OS , (Tell me if you want a pre-compiled windows version ) .
Get the project source code from here .

Thursday 5 March 2015

Yanes_ELF_id : your GUI utility to check linux executables architecture , and internal data

Yanes_ELF_id v0.2

Determine program file architecture

Description :
It allow you to check any *nix executable/lib/obj for internal version ,architecture,and many other properties
*This allows developpers/Packagers to check for architecture, version, sections and many other internal data included in the
elf object header or in in the sections.
Yanes_ELF_id is under developpement to be a solid and useful developper tool,
I plan to add signature detection  ,so you will be able to detect compilers ,packers,
compilers versions, linkers and their versions and collect idea  about used and imported/exprted functions /modules or units ,
 and may be allowing users to patch their generated executables .
*Testing :
This tool is tested under Ubuntu 14.04 x64 , please provide results for use in other distros .
download :
the current compiled binary is the amd64 version , download it from here : Yanes_ELF_id v0.2

Wednesday 4 March 2015

Yanes-GMime : Updated to 0.2 , Now more stable and effective

Yanes-GMime : Change your Mimetypes names , icons and default apps under gnome desktop

Yanes-GMimev0.2

Due to lack of a such tool under Gnome envirenment , Many internautes from
the linux community (using Ubuntu , fedora,..) are asking for a simple way to
change mime types on their gnome desktops ,
you may want to assign a specific icon to your files , or
assign a specific application to open some file type ,
or even make mime type for your source files , or documents  diffrent from the default one .
Yanes-GMime make all the needed changes in single click , in a very simplified 
Graphical Interface .

* New in version 0.2:
* More compatibility with Gnome Envirenment under Ubuntu .
* Added compatibility with KDE predifined mimetypes .
* Fixed major bug when dealing with Double defined Mimetypes.
* Is now almost  compatible with the FreeDesktop.org specifications .


*Testing :
This tool is tested under Ubuntu 14.04  x64
please provide results for use in other distros .
*Download :
get it from here: Yanes-GMimev0.2-x64 .
The only compiled version is the amd64 ,I will try to get the x86 one
ready soon .

I'm waiting for comments and test results to improve it