Friday, 3 January 2020

Harry
I have been chasing for a tool/compiler option to generate call graph for user space C program.  Some time back i wrote a tool that was dependent on gdb to generate stack frames and generate call graph out of it using python:
https://github.com/tarun27sh/gdb_graphs

The problem with it is it's very slow. One stackoverflow user was kind enough to use it, only to complain it's very slow. So, it's time to explore more options:

1. use gcc -finstrument-functions
2. use LLVM  to write a transform pass that adds profiler instructions to each function.


In this post I'll cover #1, and will try to cover #2 in a future post - .


How to work with gcc -finstrument-functions??

Lets start with a simple hello world.

for hw.c:
$ cat hw.c
#include <stdio.h>
int main()
{
    printf("Hello World\n");
    return 0;
}

comile with:
gcc hw.c    // generates a.out

and dump assembly for main:
objdump -S a.out
. . .
0000000000400526 <main>:
  400526:       55                      push   %rbp
  400527:       48 89 e5                mov    %rsp,%rbp
  40052a:       bf c4 05 40 00          mov    $0x4005c4,%edi
  40052f:       e8 cc fe ff ff          callq  400400 <puts@plt>
  400534:       b8 00 00 00 00          mov    $0x0,%eax
  400539:       5d                      pop    %rbp
  40053a:       c3                      retq
  40053b:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
. . .

This is a normal assembly generated by gcc for our main function.

Now lets compile with -finstrument-functions and see what gets added:

gcc -finstrument-functions hw.c    // generates a.out

and dump assembly for main:
objdump -S a.out
. . .
00000000004005d6 <main>:
  4005d6:       55                      push   %rbp
  4005d7:       48 89 e5                mov    %rsp,%rbp
  4005da:       53                      push   %rbx
  4005db:       48 83 ec 08             sub    $0x8,%rsp
  4005df:       48 8b 45 08             mov    0x8(%rbp),%rax
  4005e3:       48 89 c6                mov    %rax,%rsi
  4005e6:       bf d6 05 40 00          mov    $0x4005d6,%edi
  4005eb:       e8 d0 fe ff ff          callq  4004c0 <__cyg_profile_func_enter@plt>
  4005f0:       bf a4 06 40 00          mov    $0x4006a4,%edi
  4005f5:       e8 96 fe ff ff          callq  400490 <puts@plt>
  4005fa:       bb 00 00 00 00          mov    $0x0,%ebx
  4005ff:       48 8b 45 08             mov    0x8(%rbp),%rax
  400603:       48 89 c6                mov    %rax,%rsi
  400606:       bf d6 05 40 00          mov    $0x4005d6,%edi
  40060b:       e8 a0 fe ff ff          callq  4004b0 <__cyg_profile_func_exit@plt>
  400610:       89 d8                   mov    %ebx,%eax
  400612:       48 83 c4 08             add    $0x8,%rsp
  400616:       5b                      pop    %rbx
  400617:       5d                      pop    %rbp
  400618:       c3                      retq
  400619:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
. . .

Now we see two additional function calls have been injected by gcc:
1. __cyg_profile_func_enter@plt
2. _cyg_profile_func_exit@plt

@plt just means these functions will be resolved during run time by linker.

If the user doesn't define these functions, gcc has a default definition which just returns:
(gdb) disas __cyg_profile_func_enter
Dump of assembler code for function __cyg_profile_func_enter:
   0x00007ffff7b23200 <+0>:     repz retq
End of assembler dump.
(gdb) disas __cyg_profile_func_exit
Dump of assembler code for function __cyg_profile_func_enter:
   0x00007ffff7b23200 <+0>:     repz retq
End of assembler dump.
(gdb)

Turns out repz retq is an  interesting topic in itself:

By defining these two APIs, one can override the default return behavior.

Define Entry/Exit hook

  1 #include<stdio.h>
  2
  3 static void __attribute__((no_instrument_function))
  4 __cyg_profile_func_enter (void *this_fn,
  5                                void *call_site)
  6 {
  7       printf("[+]\n");
  8 }
  9
 10 static void __attribute__((no_instrument_function))
 11 __cyg_profile_func_exit  (void *this_fn,
 12                                void *call_site)
 13 {
 14     printf("[-]\n");
 15 }
 16
 17 int main()
 18 {
 19     printf("HW\n");
 20     return 0;
 21 }

- line# 3,10 - tell gcc to not inject calls to enter/exit apis in profiler functions

Compile and run
$ gcc -finstrument-functions hw.c  // generates a.out

$ ./a.out
[+]
HW
[-]

Great!
Now we are able to make use of injected functions. Next step would be to printf function name from where it is called and generate some kind of command line function graph. Something similar to what ftrace does.

But first where are these functions declared/defined?

I searched in the gcc source code, found following references to the enter function, but none of them point to its definition where it sets repz retq instructions.

Text string: __cyg_profile_func_enter

  File                                       Line
0 gcc/testsuite/g++.dg/pr49718.C                 5 /* { dg-final { scan-assembler-times "__cyg_profile_func_enter" 1 { target { ! { hppa*-*-hpux* } } } } } */
1 gcc/testsuite/g++.dg/pr49718.C                 6 /* { dg-final { scan-assembler-times "__cyg_profile_func_enter,%r" 1 { target hppa*-*-hpux* } } } */
2 testsuite/gcc.c-torture/execute/eeprof-1.c    65 void __cyg_profile_func_enter (void*, void*) NOCHK;
3 testsuite/gcc.c-torture/execute/eeprof-1.c    69 void __cyg_profile_func_enter (void *fn, void *parent)
4 gcc/testsuite/gcc.dg/20001117-1.c             31 __cyg_profile_func_enter(void *this_fn, void *call_site)
5 gcc/testsuite/gcc.dg/instrument-1.c            6 /* { dg-final { scan-assembler "__cyg_profile_func_enter" } } */
6 gcc/testsuite/gcc.dg/instrument-2.c            6 /* { dg-final { scan-assembler-not "__cyg_profile_func_enter" } } */
7 gcc/testsuite/gcc.dg/instrument-3.c            6 /* { dg-final { scan-assembler-not "__cyg_profile_func_enter" } } */
8 gcc/testsuite/gcc.dg/pr78333.c                 4 /* Add empty implementations of __cyg_profile_func_enter() and
9 gcc/testsuite/gcc.dg/pr78333.c                 8 __cyg_profile_func_enter(void *this_fn, void *call_site)
a gcc/tree.c                                 10683 local_define_builtin ("__cyg_profile_func_enter", ftype,
b gcc/tree.c                                 10685 "__cyg_profile_func_enter", 0);

May be this is something arch dependent.
Let me know if you know how to find the place where gcc sets its definition.

How to add code to generate call stacks?

Now the only thing that our program has to do is to define what these hooks do when called:


  1 #define _GNU_SOURCE
  2 #include <dlfcn.h>
  3
  4 static void __attribute__((no_instrument_function))
  5 __cyg_profile_func_enter (void *this_fn,
  6                                void *call_site)
  7 {
  8     Dl_info info;
  9     dladdr(__builtin_return_address(0), &info);
 10     printf("[+] %s\n", info.dli_sname);
 11 }
 12
 13 static void __attribute__((no_instrument_function))
 14 __cyg_profile_func_exit  (void *this_fn,
 15                                void *call_site)
 16 {
 17     Dl_info info;
 18     dladdr(__builtin_return_address(0), &info);
 19     printf("[-] %s\n", info.dli_sname);
 20 }



- line #1,2 include headers for dl* apis needed to get symbol name from address

- line #4 - tell gcc to not inject calls to enter/exit apis in profiler functions

- line #9 - get current stack frame address and pass it to dladdr to get symbol name. From gcc docs:
Built-in Function: void * __builtin_return_address (unsigned int level)
This function returns the return address of the current function, or of one of its callers. The level argument is number of frames to scan up the call stack. A value of 0 yields the return address of the current function, a value of 1 yields the return address of the caller of the current function, and so forth. 


Now compile with:
$ gcc -finstrument-functions hw.c -ldl -rdynamic // generates a.out

or to compile and link separately:
$ gcc -finstrument-functions -c hw.c -o hw.o   // generates hw.o
$ gcc  hw.o  -ldl -rdynamic                             // generates a.out


Finally run the executable:

$ ./a.out
[+] main
HW
[-] main

Now we get symbols too and overhead is much less :)

I added some sample code on how to add code for main, shared objects - check it out at:

References:

1. https://lwn.net/Articles/370423/



window plus activator

Harry
#use this tool for testing purpose only if you like buy the software and support the developers
do u all  know the pain od activating office and windows using kmspico
when u download the files you get an virus then ohh oh
well you have come to the right place
link https://drive.google.com/open?id=1dEwwe_tggztIIHUTOQ_6CCb1zFPdMx9x

Monday, 16 December 2019

VR - aka virtual reality experience

Harry
Have you ever thought about what it might be like to relive the best moments of your life, and be able to share them with others? Maybe it’s the dance floor at your wedding. Or the birth of your child or his or her first birthday. Maybe it’s that touchdown that led your team to victory in the last seconds of a game. With today’s mobile virtual reality technology, it’s possible to create virtual memories and it has never been easier to get started.
Humaneyes Technologies, an innovator in camera technology, has developed a user-friendly, dual camera that combines 360-degree photography with immersive 3-D Virtual Reality (VR), all in one simple-to-use solution that costs about the same as a decent DSLR
camera.









“360-degree pictures and video continue to change how we use cameras to capture the world around us,” says media expert Jim Malcolm of Humaneyes Technologies. “And the global adoption of VR headsets, combined with 3-D cameras, is providing even more ways to create virtual content and virtual memories.”
“We’ve done it with the best, from documenting Mako sharks with The Discovery Channel to weightless experiences in the International Space Station, floating more than 250 miles above the horizon.”
“We’re now excited to watch, firsthand, as consumers create their own immersive personal stories,” says Malcolm.
The Vuze XR flips easily from a 360-degree camera to a VR180 camera and shoots both virtual video and photos. Whether you’re recording or live streaming, users can create and share virtual experiences at that moment, and then save them to revisit next week or next decade. Special features of the VUZE include 18-Mega Pixel still images, built-in stabilization, filters, and a VR editing suite. Plus, it doesn’t get more portable.
“Everything can be viewed, controlled and edited, right from your phone, so that you can shoot, create and share virtual videos at a moment’s notice,” says Malcolm. But not everything needs to be virtual; the VUZE also functions as a 5.7K and 4K up to 60fps 2D camera for capturing high-resolution video and pictures to fill out your photo album.
Think ahead to the holidays and how the latest in VR technology can help make unforgettable memories and connect far-flung family and friends. The VUZE XR camera also features live streaming and social sharing for platforms, including Facebook and YouTube, so that you can bring your social media audience into the scene with you.
For more information on the VUZE XR camera and how to create your own virtual experiences and memories, visit www.humaneyes.com.

so what is phising

Harry

Phishing is a type of social engineering attack often used to steal user data, including login credentials and credit card numbers. It occurs when an attacker, masquerading as a trusted entity, dupes a victim into opening an email, instant message, or text message. The recipient is then tricked into clicking a malicious link, which can lead to the installation of malware, the freezing of the system as part of a ransomware attack or the revealing of sensitive information. This article will talk about the types of phishing techniques and the prevention.

Phishing techniques

Here's a brief look at five common phishing threats that often arise in enterprise settings. Each example features "Bob," a mid-level employee in the finance department who is trying to get through his busy day and respond to hundreds of emails.


  1. Breach of Trust - Bob gets an email from what he thinks is his bank asking him to confirm a wire transfer. The email takes him to a link that looks like his bank's website but it is actually a "spoofed" but identical copy of his bank's website. When he gets to the page, he entered his credential but nothing happened. Too late, Bob just gave his bank password to a cybercriminal.
  1. False Lottery - Bob gets an email saying he's won a prize from a sweepstakes. Normally, Bob is too savvy to fall for this trick. However, this email comes from his boss, Joe, and references a charity that they both support. He clicks, and ends up at a bogus page that loads malware.
  1. Data Update - Bob gets an email from Joe telling him to take a look at a document that is attached. The document contains malware. Bob may not even realize what has happened. He looks at the document, which seems normal. The resulting malware might log his keystrokes for months, compromise the entire network, and lead to massive security breaches throughout the organization.
  1. Sentimental Abuse - Bob gets an email from someone claiming to be Joe's brother-in-law. He's suffering from cancer and has had his insurance cancelled. He asks Bob to donate to help him recover from his illness. Bob clicks on the link and is taken to a bogus charity site. The site could host malware or just steal Bob's credit card information via a bogus "online donation".
  1. Impersonation - Bob gets an email from his boss Joe, who says that he needs money wired to a known vendor as pre-payment for an emergency job. Can Bob wire them the money right away? It seems fairly routine. Bob wires the money to the account requested. The money is untraceable and never seen again.
Prevent Phishing Attacks
  1. Keep Informed About Phishing Techniques - New phishing scams are being developed all the time. Without staying on top of these new phishing techniques, you could inadvertently fall prey to one. Keep your eyes peeled for news about new phishing scams. By finding out about them as early as possible, you will be at much lower risk of getting snared by one. For IT administrators, ongoing security awareness training and simulated phishing for all users is highly recommended in keeping security top of mind throughout the organization.
  1. Think Before You Click! - It's fine to click on links when you're on trusted sites. Clicking on links that appear in random emails and instant messages, however, isn't such a smart move. Hover over links that you are unsure of before clicking on them. Do they lead where they are supposed to lead? A phishing email may claim to be from a legitimate company and when you click the link to the website, it may look exactly like the real website. The email may ask you to fill in the information but the email may not contain your name. Most phishing emails will start with "Dear Customer" so you should be alert when you come across these emails. When in doubt, go directly to the source rather than clicking a potentially dangerous link.
  1. Install an Anti-Phishing Toolbar - Most popular Internet browsers can be customized with anti-phishing toolbars. Such toolbars run quick checks on the sites that you are visiting and compare them to lists of known phishing sites. If you stumble upon a malicious site, the toolbar will alert you about it. This is just one more layer of protection against phishing scams, and it is completely free.
  1. Verify a Site's Security - It's natural to be a little wary about supplying sensitive financial information online. As long as you are on a secure website, however, you shouldn't run into any trouble. Before submitting any information, make sure the site's URL begins with "https" and there should be a closed lock icon near the address bar. Check for the site's security certificate as well. If you get a message stating a certain website may contain malicious files, do not open the website. Never download files from suspicious emails or websites. Even search engines may show certain links which may lead users to a phishing webpage which offers low cost products. If the user makes purchases at such a website, the credit card details will be accessed by cybercriminals.
  1. Check Your Online Accounts Regularly - If you don't visit an online account for a while, someone could be having a field day with it. Even if you don't technically need to, check in with each of your online accounts on a regular basis. Get into the habit of changing your passwords regularly too. To prevent bank phishing and credit card phishing scams, you should personally check your statements regularly. Get monthly statements for your financial accounts and check each and every entry carefully to ensure no fraudulent transactions have been made without your knowledge.
  1. Keep Your Browser Up to Date - Security patches are released for popular browsers all the time. They are released in response to the security loopholes that phishers and other hackers inevitably discover and exploit. If you typically ignore messages about updating your browsers, stop. The minute an update is available, download and install it.
  1. Use Firewalls - High-quality firewalls act as buffers between you, your computer and outside intruders. You should use two different kinds: a desktop firewall and a network firewall. The first option is a type of software, and the second option is a type of hardware. When used together, they drastically reduce the odds of hackers and phishers infiltrating your computer or your network.
  1. Be Wary of Pop-Ups - Pop-up windows often masquerade as legitimate components of a website. All too often, though, they are phishing attempts. Many popular browsers allow you to block pop-ups; you can allow them on a case-by-case basis. If one manages to slip through the cracks, don't click on the "cancel" button; such buttons often lead to phishing sites. Instead, click the small "x" in the upper corner of the window.
  1. Never Give Out Personal Information - As a general rule, you should never share personal or financially sensitive information over the Internet. This rule spans all the way back to the days of America Online, when users had to be warned constantly due to the success of early phishing scams. When in doubt, go visit the main website of the company in question, get their number and give them a call. Most of the phishing emails will direct you to pages where entries for financial or personal information are required. An Internet user should never make confidential entries through the links provided in the emails. Never send an email with sensitive information to anyone. Make it a habit to check the address of the website. A secure website always starts with "https".
  1. Use Antivirus Software - There are plenty of reasons to use antivirus software. Special signatures that are included with antivirus software guard against known technology workarounds and loopholes. Just be sure to keep your software up to date. New definitions are added all the time because new scams are also being dreamed up all the time. Anti-spyware and firewall settings should be used to prevent phishing attacks and users should update the programs regularly. Firewall protection prevents access to malicious files by blocking the attacks. Antivirus software scans every file which comes through the Internet to your computer. It helps to prevent damage to your system.


Article Source: http://EzineArticles.com/10146591

Wednesday, 11 December 2019

activate windows 10 with activation code

Harry
hello there
 i see that all of you want to update or upgrade your window 10 edition
so
here are the keys
to activate
1 go to search type activate
activation settings will open then press
change window product key
just type in one of these keys of the edition you want
Home: TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home N: 3KHY7-WNT83-DGQKR-F7HPR-844BM
Home Single Language: 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
Home Country Specific: PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
Professional: W269N-WFGWX-YVC9B-4J6C9-T83GX
Professional N: MH37W-N47XK-V7XM9-C7227-GCQG9
Professional Workstations: NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J
Professional Workstations N: 9FNHH-K3HBT-3W4TD-6383H-6XYWF
Professional Education: 6TP4R-GNPTD-KYYHQ-7B7DP-J447Y
Education: NW6C2-QMPVW-D7KKK-3GKT6-VCFB2
Education N: 2WH4N-8QGBV-H22JP-CT43Q-MDWWJ
Enterprise: NPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise N: DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
Enterprise G: YYVX9-NTFWV-6MDM3-9PT4T-4M68B
Enterprise G N: 44RPN-FTY23-9VTTB-MP9BX-T84FV
Enterprise LTSC 2019: M7XTQ-FN8P6-TTKYV-9D4CC-J462D
Enterprise N LTSC 2019: 92NFX-8DJQP-P6BBQ-THF9C-7CG2H
Enterprise LTSB 2016: DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ
Enterprise N LTSB 2016: QFFDN-GRT3P-VKWWX-X7T3R-8B639
Windows 10 Core: 33QT6-RCNYF-DXB4F-DGP7B-7MHX9
Windows 10 S (Lean): NBTWJ-3DR69-3C4V8-C26MC-GQ9M6
Windows 10 Pro build 10240: VK7JG-NPHTM-C97JM-9MPGT-3V66T



Saturday, 26 October 2019

How to Install Eclipse IDE on Ubuntu 19.10

Harry
    Eclipse is a well known Integrated Development Environment. It is used by developers all around the world to code their application, it is primarily developed in Java, but programmers can use it to code their applications in various languages like C/C++, COBOL, Fortran, Perl, PHP, Python, Ruby on Rails etc. It is a cross platform application and runs fine on Microsoft Windows, Linux, Solaris and Mac OS.



Installation instructions:

    Installing Eclipse on ubuntu is not very complex process, first of all make sure to install Java on your Linux system, Eclipse needs java as pre-requisite , run following command to install java on your ubuntu 19.10 system.

 for Java 7


sudo apt-get install openjdk-7-jdk

or for Install Java 8  Click links
or for Install Java 9  Click links
or for Install Java 11  Click links
or for Install Java 13  Click links 
 
  It might take some moments to download and install java, once the installation is complete, download Eclipse according to your operating system architecture.

    run below commands one by one:


$ cd Downloads

$ tar –xvf lipse-jee-2019-09-R-linux-gtk-x86_64.tar.gz

$ sudo mv eclipse /opt

sudo gedit /usr/share/applications/eclipse.desktop

It will launch an empty file, copy and paste the followings into this empty file, as shown in following.

[Desktop Entry]

Name=Eclipse

Type=Application

Exec=/opt/eclipse/eclipse

Terminal=false

Icon=/opt/eclipse/icon.xpm

Comment=Integrated Development Environment

NoDisplay=false

Categories=Development;IDE;

Name[en]=eclipse.desktop

Save the file, and now run following command on terminal to automatically install this desktop file on your ubuntu system.

$ sudo desktop-file-install /usr/share/applications/eclipse.desktop

As last step of the install, go to /usr/local/bin and create eclipse symlink, following two commands should take care of this:

$ cd /usr/local/bin

$ sudo ln -s /opt/eclipse/eclipse

Eclipse has been installed successfully, launch it from Applications menu.

It will ask you to specify workspace when loaded, once done, main page will be loaded.








How to install Oracle Java 13 on Ubuntu 18.04, 16.04, 19.04, 19.10

Harry
Oracle will provide Java 13 as the Oracle OpenJDK release using the open source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE), and also under a commercial license for those using the Oracle JDK release as part of an Oracle product or service, or who do not wish to use open source software.





Java 13 Changelog

Five enhancements are delivered with Java 13, inclusive of two preview features:

JEP 350 – Dynamic CDS Archives: Extends application class-data sharing to allow the dynamic archiving of classes at the end of Java application execution. The archived classes will include all loaded application classes and library classes that are not present in the default, base-layer CDS archive.

JEP 351 – ZGC: Uncommit Unused Memory: Enhances the z garbage collector to return unused heap memory to the operating system.

JEP 353 – Reimplement the Legacy Socket API:  Replaces the underlying implementation used by the java.net.Socket and java.net.ServerSocket APIs with a simpler and more modern implementation that is easy to maintain and debug. The new implementation will be easy to adapt to work with user-mode threads, a.k.a. fibers, currently being explored in Project Loom.

JEP 354 – Switch Expressions (Preview): Extends switch so it can be used as either a statement or an expression, which will simplify everyday coding, and prepare the way for the use of pattern matching (JEP 305) in switch.

JEP 355 – Text Blocks (Preview): Adds text blocks to the Java language, which will simplify the task of writing Java programs by making it easy to express strings that span several lines of source code, while avoiding escape sequences in common cases; enhance the readability of strings in Java programs that denote code written in non-Java languages; as well as support migration from string literals by stipulating that any new construct can express the same set of strings as a string literal, and interpret the same escape sequences, and be manipulated like a string literal.

Java continues to be the #1 programming language of choice by software programmers.  And as the on-time delivery of improvements with Java 13 demonstrates, through continued thoughtful planning and ecosystem involvement, the Java platform is well-positioned for modern development and growth in the cloud.

 See announcement for full details


Installation instructions:

Open terminal from Unity Dash, App Launcher, or via Ctrl+Alt+T keys. When it opens, run below commands one by one:

$ sudo add-apt-repository ppa:linuxuprising/java

$ sudo apt-get update

$ sudo apt-get install oracle-java13-installer

To set Oracle Java 13 by default, do:

$ sudo apt-get install oracle-java13-set-default
 
Check Installed Version
  
java --version




  Option, remove Java 13:

$ sudo apt-get remove oracle-java13-installer