Havering about Stack Buffer Overflow Basic in x64

Posted by with No comments


Stack Buffer Overflow

       Before entering to content, I just want to say.... I am very happy, jubilant, and excited! Maybe with most of people this is very easy challenge, of course, it's basic challenge! However with me, a person, who have started for a short time, it is a big problem. OK! Come back to our Stack Buffer Overflow. The challenge I mentions to, this is ELF x64 - Stack buffer overflow - basic in root-me. I'll not analyzing deeper about this challenge because of forbiden, I just havering about Overflow!

Let's begin.

       Before solving it, I read some docs which root-me give as hint. This is EN - 64 Bits Linux Stack Based Buffer Overflow.pdf .
This is the first time I read a docs about 64-bits Stack! So wtf? Everything is nameless, strange with me! I do not know that "Do it know who I am?" , but I extractly that, I do not know what is it! First impression is RIP. :v I thought that it's kidding me, dafug, RIP, what is 'RIP'? Rest in Peace? maybe :D. But no, It is Instruction Pointer like EIP, however, in 64-bits every 'E' is 'R'. That the reason why I saw RIP, RSP,..

       Next to, it's size of memory address, there are a lot of different between 32-bits and 64-bits. In 64-bits user space just only use first 47-bits. If we pass parameters greater than 47-bits one, I'll raise exceptions.
This is original text: 

So memory addresses are 64 bits long,but user space only uses the first 47 bits; keep this in mind because if you specified an address greater than 0x00007fffffffffff, you'll raise an exception. So that means that 0x4141414141414141 will raise exception, but the address 0x0000414141414141 is safe.

       Saying maybe easy, in fact, I down-at-heel with them! :D I spend a evening to check, test, and to try anyways to do them. :downface:

    
      When I see the source code, I immediately think about address of 'CallMeMaybe' function! Right! I found its address, It's very simple!
And then I must put this address in somewhere, at which program can excute at sometimes. As we know, all program when begin, it's always push return address into stack :D, so that we can take advantage of it :p. That's easy, write a payload by any programing language you like and exploit! :D Ez.. I spent more than two days to read docs, try hard to solve it! :v Ez --> spent 2 days :v

[Tips] GSoC Preparing...

Posted by with No comments

Recently, I have known about GSoC(Google Summer of Code). In my opinion, It's very useful and interesting. Maybe I was attracted by it. So, I tried to find about it, and somethings below which I got:

  • How to prepare a proposal project:  https://medium.com/@hellomeets/how-to-prepare-your-gsoc-proposal-7b59029aaa64#.tpqjoqsy0
  • Proposals collection of GSoC: https://docs.wso2.com/display/GSoC/WSO2+GSoC+Project+Proposals

Hope that it will be usefull in future for someone, and me!

[EffortLessEnglish] LIFESTYLES DISEASES

Posted by with 1 comment

LIFESTYLES DISEASES

The major contributing factor to life style related diseases, typified by diabetes, high blood pressure and heart disease, is often obesity.
Therefore, we have to think about losing surplus weight.

When I was watching TV the other day, I found a program which tried to introduce a way to cook low-calorie dishes. It showed food images for a full hour. Then they let 3 overweight guests eat 3 full servings of curry-rice ( Japanese style curry with rice). The dishes were made with lower calories than normal but that "tasting" totaled 1,800 kcal.

If you have a chance to visit to America, in which many people are struggling to lose excess weight, try watching TV. You will find it is filled with food commercials and medicines that are supposed to help you lose fat.

However, the best way to lose weght is not by eating low calorie food, but by reducing the amount of food you eat.

It is really difficult to reduce you meal portion sizes while surrounded by actual food or images of food on TV-- unless you have an unbelievably strong will. So, it is very important to keep away from this toxic food enviroment. But avoiding food advertising images is still not enough. Because if you who want to lose weight, changing your physical environment free of unhealthy food images.

This is important for all of us. We have to find a way to shift your mental focus from food to healthier foci such as sports, reading or music.

Perhaps instead of calling them "life style related diseases" we should call them "thought related diseases", fr thought and emontion are the true root causes of these diseases.

If we are always worried and anxious we may eat as an outlet for these feelings. If we constantly think of failure and problems, we may eat as a way to distract ourselves from these thoughts. Therefore, it is our negative thoughts and emontions, and our inappropriate way of dealing with them, that is the true cause of obesity and "lifestyle related diseases".

So our challenge is to shift our thoughts and emontions-- and to handle the negative ones in a better way. This is the best way to lose weght and gain health. We can enjoy the satisfaction of finishing a really fat book. We can enjoy the achievement of passing a difficult exam. We can enjoy the exertion and effort of sports. Of course, we can ecumerate many more positive pursuits. The point is, changing our mental focus is the key.

There are many ways to cultivate a healthy mental environment. We dont even have to wait. Today, or tomorrow, we can start to think in a different way.

==========================/\=======================

####################Translate#################

Những nguyên do ảnh hưởng đến cuộc sống liên quan đến bệnh tật, điển hình là bệnh tiểu đường, cao huyết áp, và bệnh tim mạch. Béo phì cũng là một những căn bệnh phổ biến. Tóm lại, chúng ta phải nghĩ đến việc làm giảm bớt cân nặng.

Khi tôi xem TV vào vài ngày trước, tôi thấy có một chương trình đang chỉ cách nấu đồ ăn ít năng lượng nhất có thể. Nó chiếu một tấm ảnh đồ ăn lên suốt một tiếng đồng hồ,sau đó họ để cho 3 vị khách "quá cỡ" ăn trọn 3 phần gạo cà ri Nhật. Bữa ăn được thiết kế với lượng calorie ít hơn thường ngày nhưng mà chúng tôi đã ăn trọn 1,800 kcal vào hôm đó.

Nếu ban có dịp đến nước Mỹ, ở đây bạn sẽ bắt gặp rất nhiều người đang phải vật lộn với việc giảm cân, không tin thử lên TV mà xem! Bạn sẽ thấy nó được chất đầy những đồ ăn thương mại và thuốc nhắm mục đích giúp bạn giảm cân.


Tuy nhiên, cách tốt nhất để giảm béo không phải là ăn những bữa ăn ít năng lượng đi, hay bởi ăn ít đồ ăn đi.

Thật khó để có thể giảm khẩu phần ăn của bạn trong khi vây quanh là những món ăn, ảnh đồ ăn ngon trên TV. Trừ khi bạn có sức chịu đựng phi thường. Vậy nên, tránh xa môi trường toàn đồ ăn độc hại là điều rất quan trọng. Nhưng tránh xa những quảng cáo về đồ ăn thôi vẫn chưa đủ. Vì nếu bạn muốn làm béo thì phải thay đổi môi trường sống của bạn không có những bức hình thức ăn độc hại đó.

Điều này rất quan trọng đối với tất cả chúng ta. Chúng ta phải thay đổi suy nghĩ từ đồ ăn sang foci tốt cho sức khỏe hơn như thể thao, đọc sách,...

Có thể thay vì gọi chúng là "phong cách sống dẫn đến bệnh tật", chúng ta có thể gọi chúng là "suy nghĩ dẫn đến bệnh tật", do suy nghĩ và cảm xúc là những nguyên do chính dẫn đến bệnh tất.

Nếu chúng ta cảm thấy lo lắng hay phiền muộn, chúng ta chúng ăn như một giải pháp thoát khỏi (lối thoát) những cảm giác đó. Nếu chúng luôn luôn nghĩ đến thất bại và các vấn đề gặp phải, chúng ta có lẽ ăn như một cách để vơi đi những suy nghĩ đó.Tóm lại, nó là những suy nghĩ tiêu cực và cảm xúc, và cách giải quyết không đúng của chúng ta với chúng, làm một ngyuên nhân chính dẫn đến béo phì và những phong cách sống liên quan đến bệnh tật khác.

Vì vậy thử thách là thay đổi suy nghĩ và cảm xúc của chúng ta- và để kiểm soát được một trong những vấn đề tiêu cực một cách tốt nhất. Đây là cách tốt nhất đê giảm cân và có được sức khỏe tốt. Chúng ta có thể thấy hài lòng với kết quả của một cuốn sách giảm cân thực thụ. Chúng ta có thể tận hưởng thành quả của việc vượt qua một bài kiểm tra khó. Chúng ta có thể cảm nhận sự cố gắng và nỗ lực của các môn thể thao. Tuy nhiên, chugns ta có thể liệt kê nhiều hơn nhũng mục tiêu mà mình theo đuổi. Mấu chốt là chay đổi suy nghĩ, nhận thức chính là chìa khóa.

 
Có nhiều cách để nâng cao môi trường sức khỏe tinh thần. Chung ta đừng lưỡng lự. Hôm nay, hay ngày mai, chúng ta có thể bắt đầu suy nghĩ khác đi!


Dịch sida thật !!!

[Cryptopals] How to Break repeating-key XOR

Posted by with No comments

For 3 weeks, It's time that I have solved this challenge! I though I would fail because my english was very bad and challenge, hints was writed by english.

Now, let's see what we have?
   I found some things good by google:
         1st:
The hardest exercise in the set by far, despite the problem description giving you a clear set of steps.
Use the length-normalised Hamming distance to guess the keysize. Contrary to the instructions which kinda indicate you need only consider the first and second blocks, I had to take the average normalised Hamming distance from the first block against all the others.
Break the input into blocks of keysize length, transpose them into a much smaller number (keysize) chunks (ByteString.transpose does the trick), crack each chunk using the code written for #3, concat the keys for each chunk. Done.
                2nd: Matasano Solution

            and so on...

Review the problem of challenge:
     
There's a file here. It's been base64'd after being encrypted with repeating-key XOR.
Decrypt it.

And hints:


Here's how:
  1. Let KEYSIZE be the guessed length of the key; try values from 2 to (say) 40.
  2. Write a function to compute the edit distance/Hamming distance between two strings. The Hamming distance is just the number of differing bits. The distance between:
    this is a test
    and
    wokka wokka!!!
    is 37. Make sure your code agrees before you proceed.
  3. For each KEYSIZE, take the first KEYSIZE worth of bytes, and the second KEYSIZE worth of bytes, and find the edit distance between them. Normalize this result by dividing by KEYSIZE.
  4. The KEYSIZE with the smallest normalized edit distance is probably the key. You could proceed perhaps with the smallest 2-3 KEYSIZE values. Or take 4 KEYSIZE blocks instead of 2 and average the distances.
  5. Now that you probably know the KEYSIZE: break the ciphertext into blocks of KEYSIZE length.
  6. Now transpose the blocks: make a block that is the first byte of every block, and a block that is the second byte of every block, and so on.
  7. Solve each block as if it was single-character XOR. You already have code to do this.
  8. For each block, the single-byte XOR key that produces the best looking histogram is the repeating-key XOR key byte for that block. Put them together and you have the key.
This code is going to turn out to be surprisingly useful later on. Breaking repeating-key XOR ("Vigenere") statistically is obviously an academic exercise, a "Crypto 101" thing. But more people "know how" to break it than can actually break it, and a similar technique breaks something much more important.
OK. Let's begin to break it!

Firstly, I try to find keylength of the key. Thank to Google.com.vn, I wrote a snippet to do it:

 This snippet I use to find hamming distance:
   
 and it is use to find normalize to determine which is keylength of key:
Run this snippet which random *keysizeMax*, I will get a probaly keysize.
      
2
2.25
-------
3
2.8333333333333335
-------
4
3.625
-------
5
2.6
29
2.8189655172413794
-------

Then, I just try one-by-one keysizes, I try to look up which keysize include english character, it's extractly keysize. In this case, the extractly keysize is 29.
 T
Ibhcl na ro
ncemmoiavano pt1dhgn an'  euY hbo.oxaa ef ygeyoar
hd
o e bc  n'ueoanteraayo yio
btdc,

Run `seq ` to brutefore key, we see T is match, next to second character of key.. we got
e
'eis adnnuuiM'a nelnsen'nol - yi
k shtrton ln mi nI rGihr  romSt YwiaYoaal  r,mry  yyy 
 emPohe,
repeat it to 29.. we will get full of key: "Terminator X: Bring the noise".

[Conversation] What are you studying?

Posted by with No comments

In a nice afternoon at 23-09 Park, a man walk through and ask:

Man: What are you studying?
Me: I'm studying Networking.... a part of information security...
Man: ohm... Do you like it?
Me: Of course,.... I very like it. It make me interesting and so on... What are you doing?
Man: I'm doing exersice morning...
Me: Oh... Your body look very fat of muscle...
Man: Thanks! It's time that I should go... Good luck!
Me: OK... Have a nice day!

Cafe Puccini

Posted by with No comments

Cafe Puccini    



My favourite spot in San Francisco is Cafe Puccini- located in the North Beach neighborhood of the city. North Beach has a long and interesting history. It was originally the neiborhood for Itanlian people, cafes and restaurant. As a kid, ther famous baseball player Joe Dimaggio lived in NOrth Beach.

The most famous period for the neighborhood, however, was in ther late 1950s and the 1960s -- when North Beach served as the center of San Francisco's literary renaissance. In paticular, North Beach was home to the Beat writers and poets. The Beat developed a new, free, open style of writing. They also challenged the conservative society of America in the 50s, and helped create San Francisco's uniquely liberal culture. Many credit the Beats as the fathers and mothers of the 1960s cultureal renaissance in America. Among the most famous Beat writes were Jack Kerouac, Allen Ginsberg, and Gary Snyder- all of whom lived in North Beach at various times in their lives. The focal point of ther movenment was City Lights Bookstore- owned by the anarchist poet Lawrence Ferlinghetti. In ther 1950s, City Lights made history when they published Allen Ginsberg's controversial poem "Howl" - which shocked mainstream Americans at the time. Soon after, Jack Kerouac followed with his books "On The Road" and "The Dharma Bums" -- and the Beat movement was born. Ferlinghetti is still the owner of the bookstore, and City Lights is still a popular independent publisher.

And North Beach is still home to artist and writers, although is has become much more expensive and now attracts wealthier residents as well as tourists. Even though the literary scene is not what is used to be- NOrth Beacj still has many faminliu owned cafes. You'll find artists, writers, poets, entrepreneurs, musicians, businesspeople, and tourists relaxing together in them.

My favorite is Cafe Puccini, which is named after the Italian opera composer. The cafe owner is Italian. He often plays opera music, and every day he sits at a table in ther back and chats with his friends. They hold long animated conversations in Italian, adding to ther music of the place.

I go to that cafe often. I usually get a mocha, find a small table, and then write articles for Effortless English. Some times I study a little Spanish orr Japanese. Sometimes I read. Sometimes I just watch the people walk by the windows. The staff never seens to mind that I stay a long time- they are always friendly.

On sunny days I sit at a table on the sidewalk, but now, during the winter, I stay indoors.

If you get a chance to visit San Francisco, stop by Cafe Puccini. Its locted near the intersection of Columbus and Vallejo streests, in NOrth Beach. Be sure to bring a book by Kerouac or Ginsberg. Sit, enjoy the opera music and relax for a while. No one will hurry you.

Port scanner in Python + C Programming

Posted by with No comments

 

Port scanner in Python 

Overview

This post will show how you can make a small and easy-to-use port scanner program
written in Python.

There are many ways of doing this with Python, and I'm going to do it using the
built-in module Socket.

Sockets

The socket module in Python provides access to the BSD socket interface. 

It includes the socket class, for handling the actual data channel, and functions 
for network-related tasks such as converting a server’s name to an address and
formatting data to be sent across the network. Source

Sockets are widely used on the Internet, as they are behind any kind of
network communications done by your computer. 

The INET sockets, account for at least 99% of the sockets in use. 

The web browser’s that you use opens a socket and connects to the web server.

Any network communication goes through a socket.

For more reading about the socket module, please see the official documentation. 

Socket functions

Before we get started with our sample program, let's see some of the socket
functions we are going to use.

sock = socket.socket (socket_family, socket_type)
Syntax for creating a socket

sock = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
Creates a stream socket

AF_INET
Socket Family (here Address Family version 4 or IPv4)

SOCK_STREAM
Socket type TCP connections

SOCK_DGRAM
Socket type UDP connections

gethostbyname("host")
Translate a host name to IPv4 address format

socket.gethostbyname_ex("host")
Translate a host name to IPv4 address format, extended interface

socket.getfqdn("8.8.8.8")
Get the fqdn (fully qualified domain name)

socket.gethostname()
Returns the hostname of the machine..

socket.error
Exception handling

Making a program using Python Sockets

How to make a simple port scanner program in Python

This small port scanner program will try to connect on every port you define for
a particular host. 

The first thing we must do is import the socket library and other libraries that
we need. 

Open up an text editor, copy & paste the code below. Save the file as:
"portscanner.py" and exit the editor
#!/usr/bin/env python
import socket
import subprocess
import sys
from datetime import datetime

# Clear the screen
subprocess.call('clear', shell=True)

# Ask for input
remoteServer    = raw_input("Enter a remote host to scan: ")
remoteServerIP  = socket.gethostbyname(remoteServer)

# Print a nice banner with information on which host we are about to scan
print "-" * 60
print "Please wait, scanning remote host", remoteServerIP
print "-" * 60

# Check what time the scan started
t1 = datetime.now()

# Using the range function to specify ports (here it will scans all ports between 1 and 1024)

# We also put in some error handling for catching errors

try:
    for port in range(1,1025):  
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        result = sock.connect_ex((remoteServerIP, port))
        if result == 0:
            print "Port {}:   Open".format(port)
        sock.close()

except KeyboardInterrupt:
    print "You pressed Ctrl+C"
    sys.exit()

except socket.gaierror:
    print 'Hostname could not be resolved. Exiting'
    sys.exit()

except socket.error:
    print "Couldn't connect to server"
    sys.exit()

# Checking the time again
t2 = datetime.now()

# Calculates the difference of time, to see how long it took to run the script
total =  t2 - t1

# Printing the information to screen
print 'Scanning Completed in: ', total

Sample output
Let's run the program and see how an output can look like
$ python portscanner.py

Enter a remote host to scan: www.your_host_example.com
------------------------------------------------------------
Please wait, scanning remote host xxxx.xxxx.xxxx.xxxx
------------------------------------------------------------

Port 21:   Open
Port 22:    Open
Port 23:    Open
Port 80:    Open
Port 110:   Open
Port 111:   Open
Port 143:   Open
Port 443:   Open
Port 465:   Open
Port 587:   Open
Port 993:   Open
Port 995:   Open

Scanning Completed in:  0:06:34.705170
Disclaimer
This program is intended for individuals to test their own equipment for weak
security, and the author will take no responsibility if it is put to any other use
 
 
====================================&&**&&===========================================
 

Port scanner in C


/*
    Port scanner code in c
*/
#include<stdio.h>
#include<sys/socket.h>
#include<errno.h>
#include<netdb.h>
#include<string.h>
#include<stdlib.h>
int main(int argc , char **argv)
{
    struct hostent *host;
    int err, i , sock ,start , end;
    char hostname[100];
    struct sockaddr_in sa;
     
    //Get the hostname to scan
    printf("Enter hostname or IP : ");
    gets(hostname);
     
    //Get start port number
    printf("\nEnter start port number : ");
    scanf("%d" , &start);
     
    //Get end port number
    printf("Enter end port number : ");
    scanf("%d" , &end);
    //Initialise the sockaddr_in structure
    strncpy((char*)&sa , "" , sizeof sa);
    sa.sin_family = AF_INET;
     
    //direct ip address, use it
    if(isdigit(hostname[0]))
    {
        printf("Doing inet_addr...");
        sa.sin_addr.s_addr = inet_addr(hostname);
        printf("Done\n");
    }
    //Resolve hostname to ip address
    else if( (host = gethostbyname(hostname)) != 0)
    {
        printf("Doing gethostbyname...");
        strncpy((char*)&sa.sin_addr , (char*)host->h_addr , sizeof sa.sin_addr);
        printf("Done\n");
    }
    else
    {
        herror(hostname);
        exit(2);
    }
     
    //Start the port scan loop
    printf("Starting the portscan loop : \n");
    for( i = start ; i <= end ; i++)
    {
        //Fill in the port number
        sa.sin_port = htons(i);
        //Create a socket of type internet
        sock = socket(AF_INET , SOCK_STREAM , 0);
         
        //Check whether socket created fine or not
        if(sock < 0)
        {
            perror("\nSocket");
            exit(1);
        }
        //Connect using that socket and sockaddr structure
        err = connect(sock , (struct sockaddr*)&sa , sizeof sa);
         
        //not connected
        if( err < 0 )
        {
            //printf("%s %-5d %s\r" , hostname , i, strerror(errno));
            fflush(stdout);
        }
        //connected
        else
        {
            printf("%-5d open\n",  i);
        }
        close(sock);
    }
     
    printf("\r");
    fflush(stdout);
    return(0);
}

Mục tiêu, kế hoạch và đi theo khuôn khổ!

Posted by with No comments
       Mục tiêu đã được đề ra như súng đã lên đạn! Chỉ chờ thời gian trôi và thực hiện nữa thôi, thế nhưng tết đúng là tết... Tết đã lấy đi thời gian quý báu của mình và chỉ sau 3 ngày ăn tết bỗng nhiên nhác hẵn ra .... haha. Đến lúc đi vào khuôn khổ rồi, nếu không sẽ thêm một năm nữa trôi qua phí phạm mất! Hành động ngay đi, không đến khi tổng kết năm cũng chỉ có đôi chữ là "hết năm mà vẫn chưa làm được gì!"

    Điểm lại những thứ cần làm nào!
 - Tiếng anh: nếu cứ theo cách học này, khả năng nghe của mình sẽ tiến triển tốt tuy nhiên hạn chế đó là khả năng nói! - Nhưng thôi khả năng nói phải có môi trường mới có thể học và duy trì được, nên cứ từ từ.
- Lậpt trình: Các đàn anh bảo là học lập trình chỉ cần học algorithm là đủ, tuy nhiên giỏi thì càng tốt! OK mình sẽ cố giỏi! Hiện tại kế hoạch của mình đề ra đó là học thêm python và làm các bài tập algorithms - phải công nhận là nó khó thật! Đúng là lập trình có khác khó kinh tởm. Nhưng không sao, mình thích thì mình học thôi... ez.
- OS: Cái này chưa đâu đến đâu nè!!! Lúc thì bảo đọc.. đọc rồi mới thấy là nên làm bài tập.. mà xong một hồi cũng quên luôn!!
- RE-kiemanowar: Cái này cũng khá là hay, mình cứ theo lô trình chắc cũng ổn.
- Crypto: Cái trang cryptopals cũng khá là hay! Nhưng mà khó :)))

[TET Hoiliday] 27AL

Posted by with No comments
 


In 27 lunar calendar! Mdrak it has been rain for 3 months, maybe. Poor it, poor me! Having come back to home for 5 days. Most of my feelings is ... bored. I sad for weather. The weather is terrible day by day when I was child till now.

[NHẢM] BÀI CHÉM GIÓ ĐẦU TIÊN !

Posted by with No comments
  

        Cuối cùng đã xong kế hoạch cho 2 tháng đầu năm! Phải nói là vất vả, nhìn vào cái thời gian biểu là biết luôn lại thêm 1 năm nữa "sống cô đơn cho gái thèm chơi"! Biết sao giờ, cuộc sống mà, phải vậy thôi :)). Quay trở lại vấn đề, theo như kế hoạch 2 tháng đầu năm thì mình sẽ tiếp tục gỉai quyết 2 cuốn sách TCP/IP Illustrated và Inside Network - 2 cuốn khá là khó "nhai"! Từ ngữ khá là khó hiểu, kiến thức thì lại bao quát rất rộng, để hiểu được không phải ngày một ngày hai. Tiếp theo là học Python  - một ngôn ngữ "tai phải" của dân IS đặc biệt là Pentest - theo mình nhận định! Đọc qua thấy cũng khá là hay, mà chắc cũng dễ học vì thấy nó cũng chỉ có chữ latin và số thôi..nói chung là <256 kí tự, ez... :v. Một cái quan trọng nữa đó là algorithms, vì bản chât ngu si nên phải học nhiều thôi!!! Nhưng cũng phải công nhận là nó không đơn gỉan chút nào! Không vấn đề gì! Mình giỏi mà, học ba cái đơn gỉan này thì có nhằm nhò gì đâu :3. Tiếp theo là Operating System Concepts - nguyên lí hệ điều hành??? Chắc vậy.. nói chung là làm xong đông bài tập trong đó hy vọng mình có thể tạm gọi là pre-master :))... đùa ấy mà :)). Cuối cùng cái không thể thiếu đó là tiếng anh :) EffordLessEnglish là sự lựa chọn của mình :). Vì sao? Đơn gỉan bởi vì mình thấy nó thực tế, cách học khá là natural..-> tiếp thu natural luôn :D Chỉ vậy thôi, với là điều quan trọng là mình có thể tranh thủ thời gian đi xe bus để học nó :)) !!

       Nói nhảm nãy giờ thế chắc cũng ôn rồi đấy nhỉ! Nói mà chẳng ai nghe riết cugnx tự kỷ. Nhưng mà thà tự kỷ để viết còn hơn là chẳng biết làm gì :)) Phải viết để con trường nhiều văn thơ hơn, để câu từ được trau truốt hơn, và để thả thính chất lượng hơn :) Suy cho cùng thì cũng chỉ vì "gái" :) Đúng là "ế" lâu năm, giờ từ "gái" nó đã in sâu vào tiềm thức và từ bao giờ trở thành động lực của lời nói rồi ....

CTF WEBSITE COLLECTION

Posted by with No comments
   Vào một đêm mặt trời đỏ rực, đang lướt sóng trên google để tìm vài site #CTF tập chơi này nọ, tìm cơ mình tìm ra được bộ này. Chà trông có vẻ khá đầy đủ và bổ ích! Vậy nên mình quyết định share lên đây để.... tiền dùng sau này! :)


Live Online Games

Recommended

Whether they're being updated, contain high quality challenges, or just have a lot of depth, these are probably where you want to spend the most time.

Others

Meta

Crypto :          

Webapp Specific

Forensics Specific

Recruiting

Paid Training

Downloadable Offline Games

Virtual Machines

Inactive or Gone

Just around for historical sake, or on the off-chance they come back.

[HVA] HOW TO ATTACK TO A ECONOMIC, POLITICAL ORGANIZATIONS NETWORK?

Posted by with No comments
   The attack on economic, political organizations network are persistent attacks. It need more high resources, time, and skills to pervade (xâm nhập). Oficially, it is supported by a organization or a nation. The purpose of this action is to burglar informations, plans,.. this action is called Advance Persistent Attack (APT).

Ways of proceeding:

- Compromise: In this step, the attackers try everyway to attack to trick,put backdoor or trojan in organization's employee who works in the target organizations. They can be: fake mail, fake website, Social Enginering,...
- Establishing a foothold:  
- Privileging Escalation:
- Investigating architecture of network:
- Expoiting:
-  Maintaining accessibility:
- Finishing mission:

[LV2] Meddling Mother-in-law

Posted by with No comments
Meddling Mother-in-law

Wife ready to wash her hands of meddling mother-in-law.

Dear Abby,

How do I politely tell my mother-in-law to stopđộng doing my laundry? It all started when I was on bed rest due to my pregnancy. I didnt mind her doing an occasional load to help us out. But now she does it anytime she's over to watch the kids.

I'm very picky about how I do my laundry, and this is the main reason I don't want her doing it. Also, I'd prefer she spend time playing with the kids than with the lanndry! 

She also puts things away in the wrong places. SHe does it with my dishes, too. Once I told her not to worry about my laundry because I wasnt done sorting it. She took it upon herself to do it anyway.

She's very strong-willed. My husband and I have had problems with her not respecting our parenting, too. She offten take things the wrong way. What's the best way for us to tell her that her help is not needed?

== DIRTY FAMILY LAUNDRY

 **Vocabulary: politely, laundry, pregnancy, picky, respect,...

      - laundry: (n) giawtj ủi, pregnancy: (n) mang thai, to picky: khó tính, to respect: tôn trọng..

===========================================
     Người vợ sẵn sàng cắt đứt quan hệ với mẹ kế "xí xớn"

  Làm sao tôi có thể nói với mẹ kế của tôi rằng đừng giat đồ của tôi nữa mà không làm mất lòng? Mọi thứ bắt đầu kể từ khi tôi nằm cả ngày trên dường vì mang thai. Tôi không phiền vì những hành động giups đỡ vài lần của bà ấy. Thế nhưng bà ấy cứ đến thăm đứa trẻ, liên tục.

Tôi rất kỹ với cách xử lí giặt ủi của tôi, và đó là nguyên nhân chính khiến tôi không muốn bà ấy làm như vậy! Với lại tôi muốn bà ấy dùng nhiều hơn gian để chơi với lũ trẻ hơn là với đống đồ của tôi.

Bà ấy cũng đặt lộn xộn mọi thứ nữa. Bà ấy làm chuyện đó với bát chén nữa. Một lần tôi đã nói với bà ấy là đừng có bận tâm về chuyện giat đồ nữa, vì tôi sẽ xếp không kịp đâu. Bà ấy đã tự ý làm nó!

Bà ấy thật bướng bỉnh, tôi và chồng cũng gặp vấn đề về chuyện không tôn trọng sự quan tâm của bà ấy. Bà ấy thường làm mọi thứ trở nên tồi tệ hơn. Cách tốt nhất là gì để tôi có thể nói cho bà ấy biết rằng, sự giups đỡ của bà ấy là không cần thiết?

Đa năng hóa toán tử "<<" && ">>"

Posted by with No comments

//Chỗ dành cho comment cá nhân, nhưng hiện tại chưa có comment!







============================================

Chap ?? : Đa năng hóa toán tử "<<" và ">>"


I. Tìm hiểu về ý nghĩa của << và >> trong việc xuất nhập trong C++ 
Tìm hiểu về 2 toán tử << >>
Trong C : nó là toán tử 2 ngôi, khi tham số là 2 số nguyên thì được biết với cái tên dịch bit

Trong C++ :
Ngày hôm nay học về toán tử << và toán tử >> . Lúc đầu cảm thấy rất khó hiểu, về sau quyết định về nhà tìm hiểu bằng được họ hàng và gốc rễ thằng toán tử này mới được. Và sau 3h ngồi đọc mấy cái file .h ở trong thư mục BC. Đã phát hiện ra rất nhiều điều lý thú sau đây :
1. Xèng khẳng định đây là 1 toán tử bình thường có 2 toán hạng tham gia. Nó ko phải là 1 thứ đặc biết gắn liền với cin như các bạn nghĩ. Có nghĩa là ko phải cứ >> là phải đi liền với cin và << phải đi cùng với cout. 
>> và << là 1 toán tử bình thường như + - * / mà trong đó cin, cout là 1 trong 2 thành phần tham gia vào phép toán mà thôi.
Ví dụ : a+b :đây là phép toán bao gồm 2 thành phần là a và b
cin>>a :đây là phép toán bao gồm 2 thành phần là cin và a
chứng minh :
Xèng viết đoạn code sau và nó chạy hoàn toàn đúng : 


#include 
#include 
class phanso    {        private:
            int t// tu            int m// mau        public:            friend void operator>>(phanso &,istream &);            friend void operator<<(phanso,ostream&);    };
void operator>>(phanso &x,istream &is)    {
        is>>x.t>>x.m;    }
void operator<<(phanso x,ostream &os)    {
        os<<x.t<<"/"<<x.m;    }
void main(void)    {
        clrscr();        phanso a;        a>>cin;        a<<cout;
        getch();    }  

Tại sao xèng lại cố tình để kiểu dữ liệu trả về là void tôi sẽ trình bày ở đoạn dưới. 
Tại sao xèng lại cố tình thay đổi vị trí của 2 thành phần tham gia, tại sao xèng lại a>>cin??
Vì xèng muốn khẳng định với các bạn rằng đây là 2 toán tử hoàn toàn bình thường như + - * / mà thôi. Nội tại nó ko có quy tắc gì đặc biệt cả.
Cái đặc biệt nằm trong thằng cin, cout. Thằng cin, cout nó có kiểu dữ liệu là istream và ostream.
Xèng đã đổi vị trí 2 thành phần và dùng a>>cin và a< để chứng tỏ rằng, toán từ này hoàn toàn bình thường, ko phải bị gò bó trong 1 quy tắc.




2. Giải thích thành phần 2 tham số : 
Ta có : istream & operator >> (istream& is, phanso &x)
Ta thấy rõ ràng ở đây có 2 tham số. 
1 là is có kiểu dữ liệu là istream& tương ứng với cin.
cin được định nghĩa trong iostream như sau : 

istream_withassign _Cdecl cin;  

Vì vậy khi ta cin>>a chính là ta truyền thằng cin vào và trở thành toán hạng đầu tiên, a là toán hạng tiếp theo

#include 
#include 
class phanso
    
    {
        private:
            
        private:            int t// tu
            
            int m// mau
        
        public:
            
            friend void operator>>(istream &,phanso &);
    };
    };void operator>>( istream &isphanso &x)
    {
        
    {        is>>x.t>>x.m;
        
        //cin>>x.t>>x.m
    
    }

void main(void)
    {
        
    {        clrscr();
        
        phanso a;
    
                      
                          cin>>a;
        
        getch();
    }  
    }  
Dùng cin hay is ?
Cái ta sẽ truyền vào chính là cin.
Nếu is ở đây chỉ là 1 tham biến hình thức, khi ta gọi cin>>a thì cin được truyền vào. Và cái is>>x.t>>x.m; lúc nãy cũng đơn giản chính là cin>>x.t>>x.m
Ok?
3. Giải thích tại sao phải trả về kiểu dữ liệu istream & và việc return
Như đã thấy ở trên. Xèng có thể dùng kiểu dữ liệu void. Nó vẫn hoàn toàn đúng. Ko có gì sai cả. vậy tại sao người ta ( thầy phạm văn ất, thầy quách tuấn ngọc) lại để kiểu dữ liệu trả về là istream &. 
Điều đầu tiên ở bài 1 ,2 trên của xèng chỉ có thể dùng cin với 1 đối tượng chứ ko thể cin liên tiếp nhiều đối tượng. ko thể cin>>a>>b được. ha ha ha. 

Nếu đổi về như này istream & operator>>( istream &is, phanso &x)) và return is thì lại có thể cin>>a>>b liên tiếp được
Giải thích nha 

#include 
#include 
class phanso
    
    {
        private:
            
        private:            int t// tu
            
            int m// mau
        
        public:
            
            friend istream operator>>(istream &,phanso &);
    };
    };istream operator>>( istream &isphanso &x)
    {
        
    {        is>>x.t>>x.m;
        
        //cin>>x.t>>x.m
                      
                      return is;
    }
    }
void main(void)
    {
        
    {        clrscr();
        
        phanso a,b,c;
    
                      
                          cin>>a>>b>>c;
        
        getch();
    }  
    }  

cin>>a>>b>>c;
+ đầu tiên : 1 biểu thức toàn toán tử >> , toán tử này được ưu tiên thực hiện từ trái qua phải.
+ Vậy cin>>a được thực hiện trước. >> đã được đa năng hóa, thực hiện với 2 thành phần, thành phần 1 là cin và a
+ Sau đó return is cái gì được return ???? chính là cin. Vậy cin được trả về.
Biểu thức lúc này trở thành : (a đã được nhập)
cin>>b>>c
+ biểu thức vẫn toàn toán tử >> , toán tử này được ưu tiên thực hiện từ trái qua phải. vậy cin>>b tiếp tục được thực hiện và trả về cin. Sau khi nhập xong b thì trả về cin và biểu thức lại trở thành cin>>c;
Hj hj hj hj
Ok?


More linh tinh thêm: ngoài ra chúng ta hoàn toàn có thể dùng cerr và clog để in ra màn hình 

#include 
using namespace std;

void main()
{
    
{    cerr<<"abc";
    
    clog<<"egd";
}  
}  

đây cũng là 2 đối tượng khác


II. Bản chất của nó
+ nó là toán tử 2 ngôi
+ giá trị trả về : khi đa năng hóa toán tử này chúng ta thường trả về tham chiếu đến cin và cout
+ thứ tự ưu tiên của nó từ trái sang phải
==> phép đa năng hóa không bắt buộc phải trả về
==> phép đa năng hóa bắt buộc phải có 1 tham số nếu là phương thức của lớp
==> phép đa năng hóa bắt buộc phải có 2 tham số nếu là global function 

III. Code đa năng hóa mẫu

#include
using namespace std;#include
  class phanso{private:    int tu; // tuso    int mau; // mausopublic:    friend istream& operator>>(istream &,phanso &);    friend ostream& operator<<(ostream&,const phanso &);};istream& operator>>(istream &is,phanso &x){    return is>>x.tu>>x.mau;}ostream& operator<<(ostream &os,const phanso &x){    return os<<x.tu<<"/"<<x.mau;}void main(void){    phanso a;    cin>>a;    cout<<a;     getch();} 

IV. Chú ý và ngoại lệ
chú ý quan trọng vô cùng khi làm việc với toán tử đó là thứ tự ưu tiên và chiều ưu tiên của toán tử

IV. Mở rộng

endl, hex, oct được định nghĩa như nào ?

hôm nay có người hỏi tôi câu hỏi rất hay như này
endl nó được định nghĩa như này ?

ostreamendl ostreamos )
{
       
{       os.push('\n');
       return 
       return os;
}  
}   
vậy thì câu lệnh 
cout<
ko hiểu thằng endl được truyền tham số vào như nào 

câu hỏi khá hay và khá ảo, bạn ơi vấn đề là thằng toán tử << có 1 hàm overload như này
tôi demo lại cho dễ hiểu nha

friend ostreamoperator<<(ostream &osostream& (*p)(ostream&) )
{
       return 
{       return p(os);
}  
}  

Nguồn: http://diendan.congdongcviet.com/threads/t24853::ban-chat-cua-toan-tu-gt-gt-lt-lt-kha-nang-da-nang-hoa-gt-gt-lt-lt-cpp-toan-tu-xuat-nhap.cpp