Pages

Saturday, May 29, 2021

Fedora 34 : Upgrade to the last version Fedora 34 Linux distro.

Today I upgraded from the fedora 33 version to the new Fedora 34 Linux distro version.
Here are the commands I used to upgrade this Linux distro:
[root@desk mythcat]# dnf upgrade 
[root@desk mythcat]# dnf --refresh upgrade
[root@desk mythcat]# dnf system-upgrade reboot
The whole process will require a restart and then continue with the following commands:
[root@desk mythcat]# dnf install dnf-plugin-system-upgrade --best
[root@desk mythcat]# dnf system-upgrade download --refresh --releasever=34 --allowerasing --skip-broken
[root@desk mythcat]# dnf system-upgrade reboot
[root@desk mythcat]# rpm --rebuilddb
[root@desk mythcat]# dnf distro-sync --setopt=deltarpm=0
[root@desk mythcat]# dnf install rpmconf
[root@desk mythcat]# rpmconf -a
[root@desk mythcat]# reboot
You can find this version on the official webpage.

Tuesday, May 25, 2021

Fedora 33 : Programming with the ncurses library - part 002.

Another example with this library, see the screenshot:

#include <ncurses.h&gt 

WINDOW *win;
int startx, starty, width, height;
int cport;


WINDOW *makewin(int h, int w, int y, int x)
{
    WINDOW *lwin;

    lwin = newwin(h, w, y, x);
    box(lwin, 0 , 0);
    wrefresh(lwin);

    return lwin;
}

void dewin(WINDOW *lwin)
{
    wborder(lwin, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
    wrefresh(lwin);
    delwin(lwin);
}

void getInput(){
    win = makewin(height, width, starty, startx);
    wbkgd(win, COLOR_PAIR(1));
    mvwprintw(win, 0, 8, "Question 1 : ");
    mvwprintw(win, 2, 4, "What is your age?");
    mvwprintw(win, 3, 4, "dd/mm/yy:");
    wrefresh(win);
    wscanw(win, "%d", &cport);
}

int main()
{
    initscr();
    cbreak();
    keypad(stdscr, TRUE);
    start_color();
    init_pair(1,COLOR_WHITE, COLOR_BLACK);
    init_pair(2,COLOR_WHITE, COLOR_BLUE);
    bkgd(COLOR_PAIR(2));
    refresh();
    
    height = 6;
    width = 30;
    starty = (LINES - height) / 2;
    startx = (COLS - width) / 2;
    
    getInput();
    getch();

    dewin(win);
    endwin();
    return 0;
}

Sunday, May 23, 2021

Fedora 33 : Programming with the ncurses library - part 001.

I started learning C and C ++ many years ago. Around 2004, the virtualization and S.D.K. class system for the Windows operating system confused me and was not to my advantage. Later I realized that it is more advantageous and faster to create your own tools with other programming languages. It turned out that I'm right and today I'm going to show you how simple it is to use C programming on the Linux Fedora 33 distro.
This library is easy to install on the Fedora Linux distro:
[root@desk mythcat]# dnf install ncurses-devel
Last metadata expiration check: 2:33:29 ago on Sun 23 May 2021 07:15:17 PM EEST.
Package ncurses-devel-6.2-3.20200222.fc33.x86_64 is already installed.
Package ncurses-devel-6.2-3.20200222.fc33.i686 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
I created a folder and with the vim editor, I created my file called test_001.c for the first test.
[mythcat@desk ~]$ mkdir ncursesProject
[mythcat@desk ~]$ cd ncursesProject/
[mythcat@desk ncursesProject]$ vim test_001.c
This is the content to initiate and display a simple text with this library:
#include <ncurses.h>
 
int main(void){ 
        initscr();                      /* start curses mode */
        printw("Hello World !");        /* print Hello World */
        refresh();                      /* send to the real screen */
        getch();                        /* wait for user input */
        endwin();                       /* end curses mode */
        return 0;
} 
I used cc and gcc commands for C compilers to test this example and it works great:
[mythcat@desk ncursesProject]$ cc -o test_001 test_001.c -lncurses
[mythcat@desk ncursesProject]$ ls -l
total 32
-rwxr-xr-x 1 mythcat mythcat 25312 May 23 22:14 test_001
-rw-r--r-- 1 mythcat mythcat   386 May 23 22:14 test_001.c
[mythcat@desk ncursesProject]$ ./test_001 
[mythcat@desk ncursesProject]$ gcc -o test_001_gcc test_001.c -lncurses
[mythcat@desk ncursesProject]$ ./test_001_gcc 
#include <ncurses.h>

int main() { 
    // create the pointer to the window
    WINDOW *w;
    // define the data
    char list[4][8] = { "","Festila", "George", "Catalin"};
    char item[8];
    int ch, i = 0, width = 8;
    initscr(); // initialize Ncurses
    // create the new window with ncurses
    w = newwin( 6, 11, 0, 0 ); 
    box( w, 0, 0 ); // sets default borders for the window
    // now print all the menu items and highlight the first one
    for(i=0; i<4; i++) 
        {
        if( i != 0 ) 
            // highlights the first item.
            wattron( w, A_STANDOUT ); 
        else
            // highlights the next item.
            wattroff( w, A_STANDOUT );
            sprintf(item, "%-8s",  list[i]);
            mvwprintw( w, i+1, 2, "%s", item );
            //wrefresh( w );
        }
        wrefresh( w ); // update the terminal screen
        i = 0;
        noecho(); // disable echoing of characters on the screen
        keypad( w, TRUE ); // enable keyboard input for the window.
        curs_set(0); // hide the default screen cursor.
        
    // get the input if is not q key presed then run
    while(( ch = wgetch(w)) != 'q')
    { 
        // right pad with spaces to make the items appear with even width.
        sprintf(item, "%-8s",  list[i]); 
        mvwprintw( w, i+1, 2, "%s", item ); 

        // use a variable to increment or decrement the value based on the input.
        switch( ch ) 
        {
            case KEY_UP:
            i--; // increment 
            // stop the number of count list items -1
            i = ( i<0 ) ? 3 : i;
            break;
            case KEY_DOWN:
            i++; // increment
            // stop the number of count list items 
            i = ( i>2 ) ? 3 : i;
            break;
        }
    
        // now highlight the next item in the list.
        wattron( w, A_STANDOUT );
        sprintf(item, "%-8s",  list[i]);
        mvwprintw( w, i+1, 2, "%s", item);
        wattroff( w, A_STANDOUT );
    }
    // delete window
    delwin( w );
    // stop the window
    endwin();
}
This is the result:

Fedora 33 : Wordpress application desktop by Automattic tested on linux.

This application come for Android , Desktop and Mobile.
You can see this application on this website.
This is an screenshot with the application run it on Fedora Linux distro:
Download it unarchive and used like this:
[mythcat@desk ~]$ cd wordpress.com-linux-x64-6.14.0/
[mythcat@desk wordpress.com-linux-x64-6.14.0]$ ls -la
total 176264
drwxrwxrwx    5 mythcat mythcat      4096 Apr 30 14:23 .
drwx------. 104 mythcat mythcat     12288 May 23 12:29 ..
-rwxrwxrwx    1 mythcat mythcat    124662 Apr 30 14:23 chrome_100_percent.pak
-rwxrwxrwx    1 mythcat mythcat    187289 Apr 30 14:23 chrome_200_percent.pak
-rwxrwxrwx    1 mythcat mythcat   4743960 Apr 30 14:23 chrome-sandbox
-rwxrwxrwx    1 mythcat mythcat  10527632 Apr 30 14:23 icudtl.dat
-rwxrwxrwx    1 mythcat mythcat    249240 Apr 30 14:23 libEGL.so
-rwxrwxrwx    1 mythcat mythcat   3064616 Apr 30 14:23 libffmpeg.so
-rwxrwxrwx    1 mythcat mythcat   6990656 Apr 30 14:23 libGLESv2.so
-rwxrwxrwx    1 mythcat mythcat   3908248 Apr 30 14:23 libvk_swiftshader.so
-rwxrwxrwx    1 mythcat mythcat   6710080 Apr 30 14:23 libvulkan.so
-rwxrwxrwx    1 mythcat mythcat      1060 Apr 30 14:23 LICENSE.electron.txt
-rwxrwxrwx    1 mythcat mythcat   4562357 Apr 30 14:23 LICENSES.chromium.html
drwxrwxrwx    2 mythcat mythcat      4096 Apr 30 14:23 locales
drwxrwxrwx    3 mythcat mythcat        17 Apr 30 14:23 resources
-rwxrwxrwx    1 mythcat mythcat   5035565 Apr 30 14:23 resources.pak
-rwxrwxrwx    1 mythcat mythcat     51449 Apr 30 14:23 snapshot_blob.bin
drwxrwxrwx    2 mythcat mythcat        43 Apr 30 14:23 swiftshader
-rwxrwxrwx    1 mythcat mythcat    172276 Apr 30 14:23 v8_context_snapshot.bin
-rwxrwxrwx    1 mythcat mythcat       107 Apr 30 14:23 vk_swiftshader_icd.json
-rwxrwxrwx    1 mythcat mythcat 134100640 Apr 30 14:23 wpcom
[mythcat@desk wordpress.com-linux-x64-6.14.0]$ ./wpcom 
{"name":"calypso","hostname":"desk","pid":9931,"reqId":"066e63b4-d04c-4210-af52-6419e4a156fb","level":30,
"method":"GET","status":200,"length":"12940","url":"/post/null","duration":66.718,
"httpVersion":"1.1","env":"desktop","userAgent":"Chrome 87","rawUserAgent":"Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) WordPressDesktop/6.14.0 Chrome/87.0.4280.67 Electron/11.0.4 
Safari/537.36","remoteAddr":"127.0.0.1","msg":"request finished","time":"2021-05-23T09:48:44.683Z","v":0}
{"name":"calypso","hostname":"desk","pid":9931,"reqId":"6da5223a-07e0-4202-8ab0-e28940a54fbc","level":30, ...
I send my issue on GitHub for this application.
... more information on the official blog ...

Sunday, May 16, 2021

Fedora 33 : Firebase command-line interface.

This tutorial is about Firebase command-line interface and Fedora 33 Linux DIstro.
I used npm tool:
...
npm notice Run npm install -g npm@7.13.0 to update!
... 
I updated the npm to the last version with this command:
[mythcat@desk ~]$ sudo  npm install -g npm@7.13.0 

changed 14 packages, and audited 255 packages in 4s

found 0 vulnerabilities
This command will install firebase-tools:
[mythcat@desk ~]$ sudo npm install -g firebase-tools
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, 
see https://github.com/request/request/issues/3142

added 711 packages, and audited 712 packages in 2m

found 0 vulnerabilities
[mythcat@desk ~]$ firebase --version
9.10.2
[mythcat@desk ~]$ firebase login
i  Firebase optionally collects CLI usage and error reporting information to help improve our products. 
Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and 
is not used to identify you.

? Allow Firebase to collect CLI usage and error reporting information? Yes
i  To change your data collection preference at any time, run `firebase logout` and log in again.

Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=...

Waiting for authentication...

✔  Success! Logged in as ...gmail.com
After you set in the browser, you will see this:
Another way for the signin process is this command:
[mythcat@desk ~]$ firebase login:ci
In this moment I can use firebase command to see my projects:
[mythcat@desk ~]$ firebase projects:list
✔ Preparing the list of your Firebase projects
┌──────────────────────┬────────────────────┬────────────────┬──────────────────────┐
│ Project Display Name │ Project ID         │ Project Number │ Resource Location ID │
├──────────────────────┼────────────────────┼────────────────┼──────────────────────┤
...
└──────────────────────┴────────────────────┴────────────────┴──────────────────────┘

3 project(s) total.
This command connect your local project files to your Firebase project and let you to initialize a new Firebase project or use an existing one.
[mythcat@desk ~]$ firebase init hosting

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/mythcat

Before we get started, keep in mind:

  * You are initializing your home directory as a Firebase project


=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

? Please select an option: (Use arrow keys)
❯ Use an existing project 
  Create a new project 
  Add Firebase to an existing Google Cloud Platform project 
  Don't set up a default project 
After you make changes you can deploy to your site, run the following command:
✔  Firebase initialization complete!
...
[mythcat@desk ~]$ firebase deploy --only hosting
...
More about Firebase and CLI can be read on the official website.

Saturday, May 8, 2021

Fedora 33 : Simple installation of the TeamViewer utility.

TeamViewer is a comprehensive, remote access, remote control and remote support solution that works with almost every desktop and mobile platform, including Windows, macOS, Android, and iOS.
Clean the files from your system.
[root@desk mythcat]# dnf clean all
76 files removed
Get the wget tool for download:
[root@desk mythcat]# dnf -y install wget
Get the rmp file:
[root@desk mythcat]# wget https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm
--2021-05-08 16:44:17--  
https://download.teamviewer.com/download/linux/teamviewer.x86_64.rpm
Resolving download.teamviewer.com (download.teamviewer.com)... 104.16.62.16, 104.16.63.16, 
2606:4700::6810:3f10, ...
...
Connecting to dl.teamviewer.com (dl.teamviewer.com)|104.16.62.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15280308 (15M) [application/x-redhat-package-manager]
Saving to: ‘teamviewer.x86_64.rpm’

teamviewer.x86_64.rp 100%[=====================>]  14.57M  16.6MB/s    in 0.9s    

2021-05-08 16:44:19 (16.6 MB/s) - ‘teamviewer.x86_64.rpm’ saved [15280308/15280308] 
I already installed the package to talk to my son.
[root@desk mythcat]# dnf -y install teamviewer.x86_64.rpm
Last metadata expiration check: 0:04:58 ago on Sat 08 May 2021 04:40:17 PM EEST.
Package teamviewer-15.17.6-0.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete! 
The next step is to import the key from TeamViewer team development:
[root@desk mythcat]# wget https://download.teamviewer.com/download/linux/signature/TeamViewer2017.asc
...
[root@desk mythcat]# gpg --import TeamViewer2017.asc 
...
gpg:               imported: 1
Team view does not solve the basic security problems I face every day, it only offers a remote connection.

Tuesday, May 4, 2021

Fedora 33 : The new aureport tool.

The aureport Linux tool allows you to generate summary and columnar reports on the events recorded in log files.
You can see some simple examples with this tool:
[root@desk mythcat]# aureport --tty -ts today

TTY Report
===============================================
# date time event auid term sess comm data
===============================================
<no events of interest were found>

[root@desk mythcat]# aureport --start 12/31/2020 00:00:00 --end 04/05/2021 00:00:01

Summary Report
======================
Range of time in logs: 10/17/2020 22:30:47.765 - 04/04/2021 23:38:30.089
Selected time for report: 12/31/2020 00:00:00 - 04/05/2021 00:00:01
Number of changes in configuration: 76792
Number of changes to accounts, groups, or roles: 11
Number of logins: 10
Number of failed logins: 16
Number of authentications: 460
Number of failed authentications: 59
Number of users: 3
Number of terminals: 16
Number of host names: 3
Number of executables: 56
Number of commands: 76
Number of files: 0
Number of AVC's: 0
Number of MAC events: 0
Number of failed syscalls: 0
Number of anomaly events: 375
Number of responses to anomaly events: 0
Number of crypto events: 35
Number of integrity events: 0
Number of virt events: 0
Number of keys: 0
Number of process IDs: 6104
Number of events: 112473

[root@desk mythcat]# aureport -x --summary

Executable Summary Report
=================================
total  file
=================================
128351  (null)
42192  /usr/lib/systemd/systemd
3348  /usr/bin/sudo
1733  /usr/bin/su
971  /snap/anbox/186/usr/bin/anbox
754  /usr/libexec/lxdm-session
702  /usr/lib/systemd/systemd-update-utmp
311  /opt/google/chrome/chrome
119  /usr/sbin/sshd
113  /usr/bin/login
104  /opt/teamviewer/tv_bin/teamviewerd
88  /usr/sbin/runuser
84  /usr/sbin/unix_chkpwd
69  /usr/sbin/auditd
55  /usr/sbin/atd
55  /usr/sbin/auditctl
37  /usr/lib/polkit-1/polkit-agent-helper-1
...
1  /home/mythcat/blender-2.83.12-linux64/blender
...

[root@desk mythcat]# aureport -x | less

Executable Report
====================================
# date time exe term host auid event
====================================
1. 10/17/2020 22:30:47 (null) (none) ? -1 392
2. 10/17/2020 22:30:54 /usr/lib/systemd/systemd ? ? -1 395
3. 10/17/2020 22:31:14 /usr/lib/systemd/systemd ? ? -1 401
4. 10/17/2020 22:31:17 /usr/lib/systemd/systemd ? ? -1 402
5. 10/17/2020 22:31:20 /usr/lib/systemd/systemd ? ? -1 403
6. 10/17/2020 22:31:33 /usr/lib/systemd/systemd ? ? -1 406
7. 10/17/2020 22:31:37 /usr/lib/systemd/systemd ? ? -1 413
8. 10/17/2020 22:31:57 /usr/lib/systemd/systemd ? ? -1 415
9. 10/17/2020 22:32:45 (null) (none) ? -1 421
...

[root@desk mythcat]# aureport -t

Log Time Range Report
=====================
/var/log/audit/audit.log.4: 10/17/2020 22:30:47.765 - 12/21/2020 15:07:09.820
/var/log/audit/audit.log.3: 12/21/2020 15:07:19.925 - 01/30/2021 12:35:50.328
/var/log/audit/audit.log.2: 01/30/2021 12:37:35.586 - 03/08/2021 08:43:18.974
/var/log/audit/audit.log.1: 03/08/2021 08:43:19.034 - 04/27/2021 22:13:39.212
/var/log/audit/audit.log: 04/27/2021 22:13:39.217 - 05/04/2021 21:30:01.648

[root@desk mythcat]# aureport --login --summary -i

Login Summary Report
============================
total  auid
============================
15  unset
10  mythcat
1  unknown(767779)