TRANSPORT MEDZI UNIXOM - STAROFFICE PRE UNIX A WORDOM PRE MS WINDOWS

TRANSPORTING DOCUMENTS BETWEEN UNIX AND MS WORD

Treba najprv nalinkovať ISO8859-2 fonty do adresara StarOffice. Toto urobí hneď doleuvedený skript. Potom si treba stiahnuť toto makro - cpcode.zip a normálne ho rozbaliť unixovským príkazom - unzip cpcode.zip. Modul cpcode mení kódovú stránku win1250 na iso8859-2. Inštalácia: Prekopírujte modul CPcodelib.sbl do adresára StarOffice /Basic a CPcode.bmp do /StarOffice/config/symbol. Otvorte StarOffice Editor a kliknite na menu Tools/Macro.../Organizer... Na záložke libraries použijete tlačítko "append", upresníte typ súboru na BASIC a zo zoznamu vyberiete CPCodelib.sbl. Zaškrtnete voľbu "save as separate file" a ešte skontrolujete voľbu check boxu u CPCodelib (aby bol aktívny). Ukončíte tlačítkom OK. Potom kliknete na tlačítko close a cancel. Dúfajme, že sa macro dostalo na správne miesto. Teraz si pridáte ikonu na panel StarOffice. Otvoríte menu View/Toolbars/Customize. V okne Functions ako kategóriu rozviniete "StarOffice Basic Macros" a "CPCodelib". Kliknutím vyberiete CPprog a ako command označíte CPcode. Teraz myšou uchopíme obdĺžniček s nápisom CPcode a umiestnime ho na lištu vedľa symbolu zemegule. Tlačítkom "icons" otvoríme nové okno s ponukou ikon, jednu z nich vyberieme (CPcode.bmp) a potvrdíme OK. Kliknutím na vlajočku potom meníme kódovú stránku.

Pozor, všetky dokumenty MS WORD v diakritike sa dajú čítať v StarOffice, ale nefunguje spätná konverzia z Unixu do MS Word. Toto vyriešíme tým, že si odniekadiaľ pripravíme malý wordovský dokument, v ktorom bude nastavaný jazyk - slovenčina alebo čeština. Ten otvoríme vo FreeBSD v StarOffice a budeme písať. Musíme ešte dbať na typ písma, najlepší je Times New Roman a dokument musíme uložiť ako Word, samozrejme aj s konverziou z iso8859-2 na win1250. V tomto prípade môžete celkom povedať ZBOHOM Microsoftu.

First, you must link ISO8859-2 fonts to StarOfice font directory. This work will do for you the folowing script. The macro cpcode.zip is for StarOffice to make conversion between MSWord and Unix StarOffice for Eastern Europe. Unzip it in Unix with "unzip cpcode.zip". Copy CPcodelib.sbl to /StarOffice/basic and CPcode.bmp to /StarOffice/config/Symbol directories. Open StarOffice Editor and click on Tools/Macro.../Organizer... On the Libraries tab click on the "append" button, specify the file type as BASIC and choose CPCodelib.sbl. Click on the box "save as separate file". Close with OK. Then click on close and cancel. Hopefully, the StarOfice will see the macro. Now we'll put the macro icon on the panel of StarOffice. Open the menu View/Toolbars/Customize. In the Functions windows you will open "StarOffice Basic Macros" as a category and "CPCodelib". By clicking you will choose CPprog and mark CPCode as a command. Now you'll use drop-and-drag mouse movement. You will move a little button with CPcode name and will put it on the panel near the symbol of the globe (for example). With the icons button we will open a new window with the icon offer, we will choose one icon (CPcode.bmp) and will press OK. By clicking on the flag we can change the code page. NOTE: You can open all MS Word documents in Polish, Czech, Slovak or other European languages, but you must convert them to ISO8859-2 from WIN1250 by clicking on the icon. Unortunately, you can not export Slovak, Czech or other languages to MS Word format that easily. To avoid this, you must have a little Word document with LANGUAGE DEFINITION, for example, Word Document with SLOVAK language set in MS Word (few words is enough) will enable you to make further writing in the Slovak language. Then you must convert it to WIN1250 and save it as MS Word format. Hopeully, if you're succesful, you can say good-bye to Microsoft.

(Tento skript som odiekadiaľ stiahol a už si nepamätám odkiaľ.)

#!/bin/sh

STAR_OFFICE_ROOT=/Office51
FONTS_DIR=/usr/share/fonts/ISO8859-2/Type1

# -----------------------------------------------------------------------
# Tento skript nalinkuje iso8859-2 fonty do StarOffice. Needitujte skript pod rymto riadkom.

# Script that will make a link of ISO8859-2 fonts to StarOffice directory.
# -----------------------------------------------------------------------

XP3_DIR=$STAR_OFFICE_ROOT/xp3

if [ -e $XP3_DIR/psstd.fonts.il2 ]; then
  echo "Zmeny uz boli raz prevedene! Nemozno previest znova."
  echo "Ak je nejaky problem a predsa to chcete, tak zmazte subor"
  echo "  $XP3_DIR/psstd.fonts.il2"
  exit 1
fi

if [ -e $FONTS_DIR/afm ]; then
  AFM_DIR=$FONTS_DIR/afm
else
  AFM_DIR=$FONTS_DIR
fi

# Link AFM files.
ln -sf $AFM_DIR/*.[aA][fF][mM] $XP3_DIR/fontmetrics/afm

# Link PFB files.
ln -sf $FONTS_DIR/*.[pP][fF][bB] $XP3_DIR/pssoftfonts

grep "\.pf" $FONTS_DIR/fonts.dir \
  | sed -e 's/\.pfb /, /g' -e 's/-0-0-0-0-/-%d-%d-%d-%d-/g' \
  > $XP3_DIR/psstd.fonts.il2

cat $XP3_DIR/psstd.fonts.il2 >> $XP3_DIR/psstd.fonts

__________________________________________________________________________________

Tento skript je na Linuxovské (i iné Unix) shareware, ktoré sú časovo obmedzené. Skript zmení dátum a následne ho vráti späť. Pozor, vo FreeBSD je trochu iná syntax na dátum, takže tento skript nefunguje v Linuxe. Shareware, ktoré majú vlastné daemony, nemusia fungovať.

A date cracking script.

 

# This is a date cracking script for FreeBSD, (c) Juraj Sipos, 1999
#!/bin/sh
# the following sets the variable "fname" that keeps the original date value

fname=`date "+ %y%m%d%H%M"`

# the following sets the old date, 99 is for 1999, nasledovné nastaví starý dátum, ktorý bude iba jeden
# 10 is for month, 01 is for day, 1534 is time; change the date appropriately

date 9910011541

# include here the program to run, make sure the program is in your
# path or write, e.g. /usr/bin/joe Daj sem nejaký program

joe

# the following returns your original date, make sure you normally Nasledovný príkaz vráti pôvodný dátum späť
# end the program with its close buttons when using X, otherwise
# your original date will not be switched back

date $fname
exit 0

___________________________________________________________________________________

Toto je miniatúrny firewall, ktorý zachytí bežiace procesy a po spustení zabije každý nový proces.

A little firewall that will kill all running processes that opened after your connection to the net.

#!/bin/bash
# Secmach - security program  : bezi v pozadi a zabije kazdy program, ktory
# sa spusti po spusteni tohto scriptu
# v1.0  12-14-97
# By: Corey Gaffney
export PATH=/usr/bin:/bin:/sbin

COUNTER=0
LOCATION=/usr/secmach
CHECK_TIME=10
TRUSTED=/usr/secmach/trusted
UNTRUSTED=/usr/secmach/untrusted
DIFFKILL=/usr/secmach/diffkill
TRUSTED_USERS="johndoe"
TRUSTED_ITEMS="$TRUSTED_USERS|pppd|chat|netscape|xterm|egrep|ps|ph|sed|awk|nt"

if [ ! -s $LOCATION ]
        then
        mkdir $LOCATION
        chmod 700 $LOCATION
        fi
while :
do
COUNTER=`expr $COUNTER + 1`

if [ $COUNTER -eq 1 ]
        then
    ps -aux | sed -e '1d' | awk '{print $2}' > $TRUSTED
fi
        sleep $CHECK_TIME
ps -aux | sed -e '1d' | egrep -v $TRUSTED_ITEMS | awk '{print $2}' > $UNTRUSTED
        diff $TRUSTED $UNTRUSTED > $DIFFKILL
        KILL=`grep ">" $DIFFKILL | awk '{print $2}'`
        kill -9 $KILL
done

__________________________________________________________________________________

Pomocou tohto skriptu si vytvoríte iso image pre napálenie na CD z adresára napríklad /opt/image. Ak si chcete vytvoriť bútovateľné CD, pozrite sa na tento link.

A script to make iso images.

mkhybrid -J -R -L -N -o /usr/cd.iso -v /opt/image

__________________________________________________________________________________

Často sa stáva, že keď si pripojíte dosovské disky, Unix vám zobrazí súbory iba s veľkými písmenami. Tento skript zmení názvy s veľkými písmenami na malé.

A script to change CAPITAL LETTERS to non-capital letters

#!/bin/sh
for x in *; do
 y=`echo $x | tr '[A-Z]' '[a-z]'`
 if [ $x != $y ]; then
  mv $x $y
 fi
done
 
___________________________________________________________________________________

Tento skript vám naformátuje 1.44MB diskety pre FreeBSD (Berkeley Fast File System).

To format 1.44MB diskettes for FreeBSD.

fdformat -f 1440 fd0.1440
disklabel -w -r fd0.1440 floppy3
newfs -t 2 -u 18 -l 1 -i 65536 /dev/rfd0

___________________________________________________________________________________

Toto je crackerský skript, ktorý disasembluje. Pomocou neho budete môcť vidieť "črevá" shareware a prelomiť ich bezopečnostnú ochranu. Vo Windows sa crackuje veľmi ľahko napr. zase pomocou W32Dasm.

A cracking and disasembling script.

#!/usr/bin/perl
;############ MODIFY THIS LINE WITH YOUR PERL LOCATION ############

push(@INC,"/usr/lib/perl5");
require("flush.pl");
 

;##################################################################
;######## LINUX DISASSEMBLER 2
;######## (C) SiuL+Hacky Feb 1998
;######## You may copy, modify, distribute this program and
;######## is up to you to keep this header here
;######## Usage: dasm exe_file dasm_file
;##################################################################
 

$f_input=$ARGV[0];
$f_output=$ARGV[1];
&printflush(STDOUT, "\nCreating disassembled file ...");
$return=system("objdump -d -T -x --prefix-addresses ".$f_input.">".$f_output."2");
if ($return!=0){
  print "\nERROR OPENING OBJDUMP $return";
  print "\nUsage: dasm exe_file dasm_file";
  print "\nBe sure to get objdump in your path. Check also file permissions\n";
  exit(1);
}

open(INPUT, "<".$f_output."2");

&printflush(STDOUT, "\nReading strings ...");
$_=<INPUT>;
while (!/.rodata/){
  $_=<INPUT>;
}
($rubbish, $rest)=split(/.rodata/,$_,2);
($rubbish, $rest)=split(/0/,$rest,2);
@numbers=split(/  /,$rest,5);
$size=hex($numbers[0]);
$starting_address=hex($numbers[1]);
$end_address=$starting_address+$size;
$offset=hex($numbers[3]);
open(CODIGO, "<".$f_input);
seek(CODIGO,$offset,0);
read(CODIGO,$cadena,$size);
close(CODIGO);
 

$_=<INPUT>;
while (!/SYMBOL TABLE/){
  $_=<INPUT>;
}
&printflush(STDOUT, "\nProcessing symbol table ...");
$_=<INPUT>;
while (!/^\n/){
@st_element=split(/ /, $_);
$_=$st_element[$#st_element];
chop;
$symbol_table{$st_element[0]}=$_;
$_=<INPUT>;
}
 

while (!/\.text/){
  $_=<INPUT>;
}
&printflush(STDOUT,  "\nProcessing jmps and calls ...");

######### the regex gets rid of possible line information #############
 

while (<INPUT>){
  $_=~ s/<[+_0-9a-zA-Z]>//ge;
  $_=~s/  / /g;
  if (/j/){
    ($direccion,$inst,$destino)=split(/ /,$_,3);
    $destino=~s/ //g;
    chomp($destino);
    $salto{$destino}.=($direccion." \; ");
  }
  elsif (/call/){
    ($direccion,$inst,$destino)=split(/ /,$_,3);
    $destino=~s/ //g;
    chomp($destino);
    $call{$destino}.=($direccion." \; ");
  }
}

seek(INPUT,0,0);
&printflush(STDOUT, "\nWritting references ...\n");
open(OUTPUT, ">".$f_output) || die print "\nError opening write file\n";
print OUTPUT "FILE REFERENCED\n\n";

while (!/Disassembly of section .text:/){
$_=<INPUT>;
print OUTPUT;
}
$char=".";
$counter=0;
while(<INPUT>){
$counter++;
if ( ($counter % 400)==0){
   printflush(STDOUT,$char);
   if ( ($counter % 4000)==0){
     printflush(STDOUT,"\r");
     if ($char eq "."){ $char=" ";}
     else { $char=".";}
   }
}
$copia=$_;
$_=~s/<[+_0-9a-zA-Z]+>//ge;
$_=~s/  / /g;
($direccion, $inst, $destino)=split(/ /,$_,3);
if ( defined( $symbol_table{$direccion} )){
   print OUTPUT "\n";
   print OUTPUT "---- Function : ".$symbol_table{$direccion}." ----\n";
}
if (/call/){
   $destino=~s/ //g;
   chomp($destino);
   if ( defined( $symbol_table{$destino} )){
     print OUTPUT "\n";
     print OUTPUT "Reference to function : ".$symbol_table{$destino}."\n\n";
   }
}
if ( defined( $salto{$direccion} )){
   print OUTPUT "\n";
   print OUTPUT "Referenced from jump at ".$salto{$direccion}."\n\n";
}
if ( defined( $call{$direccion} )){
   print OUTPUT "\n";
   print OUTPUT "Referenced from call at ".$call{$direccion}."\n\n";
}
if (/\$/){
        ($instruccion, $operand)=split(/\$/,$_,2);
        if (!/push/){
          ($operand, $rest)=split(/\,/,$operand,2);
        }
        chomp($operand);
        $offset=hex($operand);
        if ( ($offset <= $end_address) && ($offset >= $starting_address ) ){
          $auxiliar=substr($cadena, $offset-$starting_address);
          $length=index($auxiliar, pack("x") );
          $auxiliar=substr($auxiliar, 0, $length);
          $auxiliar=~s/\n//g;
          print OUTPUT "\n";
          print OUTPUT "Possible reference to string:";
          print OUTPUT "\n\"$auxiliar\"\n\n"
        }
  }
print OUTPUT $copia;
}
close(INPUT);
close(OUTPUT);
print "\n";
system("rm ".$f_output."2");

 

 

Juraj   xvudpapc@savba.sk