Showing posts with label JS. Show all posts
Showing posts with label JS. Show all posts

Thursday, May 28, 2015

không cho xem mã nguồn Ctr-u hoặc chuột phải blogger


Chống Chuột phải - viewsource


<style type='text/css'>
body{
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
</style>
<script type='text/javascript'>
//<![CDATA[
// JavaScript Document
var message="NoRightClicking"; function defeatIE() {if (document.all) {(message);return false;}} function defeatNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=defeatNS;} else{document.onmouseup=defeatNS;document.oncontextmenu=defeatIE;} document.oncontextmenu=new Function("return false")
//]]>
</script>


Chống Ctr + u



<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'/>
<script type='text/javascript'>
checkCtrl=false $(&#39;*&#39;).keydown(function(e){
if(e.keyCode==&#39;17&#39;){ checkCtrl=false } }).keyup(function(ev){
if(ev.keyCode==&#39;17&#39;){ checkCtrl=false } }).keydown(function(event){
if(checkCtrl){
if(event.keyCode==&#39;85&#39;){ return false; } } })
</script>




sau khi thêm đoạn script trên trước thẻ </head> tiếp theo, chung ta tìm thẻ <body> thay thẻ 
<body> Thành <body onkeydown="return false">

Wednesday, May 20, 2015

TUT JavaScript Injection And Cheatcodes




ĐÂY LÀ TÀI LIỆU GỐC BẰNG TIẾNG ANH.

JAVA SCRIPT INJECTION:-

Summary:
JavaScript injection is a little technique that allows you to alter a sites contents without actually leaving the site. This can be very useful when say, you need to spoof the server by editing some form options. Examples will be explained throughout.


Using JavaScript a user can modify the current cookie settings. This can be performed with some basic JavaScript commands. To view the current contents of your current cookies, use the following JavaScript command. Put this in your browser's URL bar.

javascript:alert(document.cookie);

Contents:

  1. Injection Basics
  2. Cookie Editing
  3. Form Editing
I. Injection Basics:
JavaScript injections are run from the URL bar of the page you are visiting. To use them, you must first completely empty the URL from the URL bar. That means no http:// or whatever.

JavaScript is run from the URL bar by using the javascript: protocol.\ but if you are a JavaScript guru, you can expand on this using plain old JavaScript.

The two commands covered in this tutorial are the alert(); and void(); commands. These are pretty much all you will need in most situations. For your first JavaScript, you will make a simple window appear, first go to any website and then type the following into your URL bar:

Code:
javascript:alert('Hello, World');

You should get a little dialog box that says "Hello, World". This will be altered later to have more practical uses. You can also have more than one command run at the same time:

Code:
javascript:alert('Hello'); alert('World');

 
This would pop up a box that said 'Hello' and than another that says 'World'.
 

2. Cookie Editing
First off, check to see if the site you are visiting has set any cookies by using this script:
 

Code:
javascript:alert(document.cookie);

This will pop up any information stored in the sites cookies. To edit any information, we make use of the void(); command.

Code:
javascript:void(document.cookie="Field = myValue");

This command can either alter existing information or create entirely new values. Replace "Field" with either an existing field found using the alert(document.cookie); command, or insert your very own value. Then replace "myValue" with whatever you want the field to be.


For example:
Code: 
javascript:void(document.cookie="Authorized=yes");

Would either make the field "authorized" or edit it to say "yes"... now whether or not this does anything of value depends on the site you are injecting it on.

It is also useful to tack an alert(document.cookie); at the end of the same line to see what effect your altering had.

3. Form Editing

Sometimes, to edit values sent to a given website through a form, you can simply download that HTML and edit it slightly to allow you to submit what you want. However, sometimes the website checks to see if you actually submitted it from the website you were supposed to. To get around this, we can just edit the form straight from JavaScript.

Note: The changes are only temporary, so it's not use trying to deface a site through JavaScript injection like this.

Every form on a given webpage (unless named otherwise) is stored in the forms[x] array. where "x" is the number, in order from top to bottom, of all the forms in a page. Note that the forms start at 0, so the first form on the page would actually be 0, and the second would be 1 and so on.

Lets take this example:

Code: 
<form action="http://www.website.com/submit.php" method="post">
<input type="hidden" name="to" value="admin@website.com">


Note: Since this is the first form on the page, it is forms[0]

Say this form was used to email, say vital server information to the admin of the website. You can't just download the script and edit it because the submit.php page looks for a referrer. You can check to see what value a certain form element has by using this script.

Code:
javascript:alert(document.forms[0].to.value)

This is similar to the alert(document.cookie); discussed previously. In this case, It would pop up an alert that says "admin@website.com"

So here's how to Inject your email into it. You can use pretty much the same technique as the cookies editing shown earlier:

Code:
javascript:void(document.forms[0].to.value="xyz@xyz.com")

This would change the email of the form to be "xyz@xyz.com". Then you could use the alert(); script shown above to check your work. Or you can couple both of these commands on one line.


Other codes:

javascript:alert("XSS By Priyanshu");

javascript:alert(0);

javascript:alert(document.forms[0].to.value="something")


document.body.contentEditable='true';document.designMode='on';void0

To move things around on the webpage

Tuesday, May 19, 2015

Code lọc kết quả chính xác qua từ khóa trên search bar của website

qua bài này mình sẽ show cho các bạn cách lọc kết quả từ thanh search của website và cho ra kết quả chỉ liên quan đến từ khóa mà người dùng nhập, việc này rất hiệu quả nếu website của bạn có một cái menu lớn, người dùng muốn tìm ra thứ họ cần tìm một cách thật nhanh, vậy hãy đọc qua post này có thể nó sẽ giúp ích cho công việc của bạn
đoạn code này không hề gửi bất kỳ truy vấn nào, nó đơn giản chỉ là check trong menu list và cho ra kết quả. ( đỡ tốn bandwidth ).
su dung Jquery lọc kết quả tìm kiếm - make search input to filter through list using jQuery
sử dụng Jquery lọc kết quả tìm kiếm - make search input to filter through list using jQuery

Thư Viện
--

--
Mã HTML
 
Mã JQuery check.

Code Đầy Đủ


How to make search input to filter through list using jQuery | nguoivietcode.blogspot.com







Tải Toàn Bộ Code



Code lọc kết quả chính xác qua từ khóa trên search bar của website
make search input to filter through list using jQuery

Monday, May 18, 2015

Code Jquery copy nội dung từ website của bạn vào clipboard của người duyệt web.

hôm nay mình sẽ chỉ cho các bạn webmaster một thủ thuật nhỏ đó là copy nội dung từ thẻ input , người dùng không cần sử dụng Ctrl + C rồi sau đó CTRL + V, theo mình cách này rất phù hợp cho các bạn làm wap, tuy nhiên bạn ứng dụng nó với mục đích gì cũng được, nói vậy thôi nhé giờ là code.

khai báo thư viện 2 file js này sẽ làm nhiệm vụ copy to clipboard
 


thêm 1 chút css cho thẻ <input>


Đoạn Script thực thi

Tiếp theo là thẻ <input> và <a>

Copy Now
Code Đầy đủ

  
    How to copy text to Clipboard using jQuery | nguoivietcode.blogspot.com
    
 




  
  
    

How to copy text to Clipboard using jQuery Example.   => Home | More codes

Copy Now
Bạn có thể thay đỗi 1 vài tham số cho phù hợp. đừng quên tải 3 file này về





Code Jquery copy nội dung từ website của bạn vào clipboard của người duyệt web.
copy text to Clipboard using jQuery

Code Java script kiểm tra độ mạnh - yếu của mật khẩu

ở bài viết này mình sẽ chia sẽ với bạn một cách kiểm tra mật khẩu có độ mạnh hay yếu giống như các trang đăng ký nổi tiếng như google account, yahoo, zing id vv...
việc này rất quan trọng đối với những website có sử dụng chức năng đăng ký tài khoản, giúp website của bạn trở nên chuyên nghiệp hơn.
sau đây mình sẽ đưa ra năm mức độ của mật khẩu. rất yếu - yếu - trung bình - mạnh và rất mạnh.
một mật khẩu được cho là mạnh khi bạn có 13 chữ bao gồm ký tự,chữ sô in và thường, các dấu đặc biệt..

trong bài viết này chúng ta có sử dụng
jQuery/HTML/CSS

- đầu tiên chúng ta cần dẫn tới thư viện JQuery
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>

<script type="text/javascript" src="jquery.pwdMeter.js"></script>
download 2 file trên tại link :








 - đoạn Java Script thực thi check password
<script type="text/javascript">

    $(document).ready(function(){


            $("#password").pwdMeter();


        });

    </script> 
hàm pwdMeter() để kiểm tra. bạn có thể thay đỗi giá trị mặc định này ở file jquery.pwdMeter.js

- tiếp theo chúng ta sẽ thêm một chút CSS
<style>
.veryweak{
color:#B40404;
}

.weak{
color:#DF7401;
}

.medium{
color:#FFFF00;
}

.strong{
color:#9AFE2E;
}

.verystrong{
color:#0B610B;
}
</style>
HTML form
thẻ span sẽ xuất ra kết quả.
<div id="grid">
  <input type="password" id="password">
  <span id="pwdMeter" class="neutral"></span>
</div> 
ok. ở trên là mình phân tích từng phần cho các bạn mới học làm website dễ hiểu hơn, còn đây là code đầy đủ hơn.
<http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title>Kiểm tra độ mạnh của mật khẩu sử dụng JQuery | nguoivietcode.blogspot.com</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <script type="text/javascript" src="jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="jquery.pwdMeter.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){

                $("#password").pwdMeter();

            });
    </script>
    <style>
        .veryweak{
            color:#B40404;
        }
        .weak{
            color:#DF7401;
        }
        .medium{
            color:#FFFF00;
        }
        .strong{
            color:#9AFE2E;
        }
        .verystrong{
            color:#0B610B;
        }
    </style>
  </head>
  <body>
    <h2>Kiểm tra độ mạnh của mật khẩu sử dụng JQuery <a href="http://www.nguoivietcode.blogspot.com/">Blog người viết code</a></h2>
    <div style="margin-left:auto;margin-right:auto; width:280px;"><input type="password" id="password" />&nbsp;
    <span id="pwdMeter" class="neutral"></span></div><br />
  </body>
</html>

vậy là hoàn thành, chúc các bạn áp dụng vào thực tế một cách hiệu quả :)
Code Java script kiểm tra độ mạnh - yếu của mật khẩu
Kiểm tra độ mạnh của mật khẩu sử dụng JQuery
Password Strength checker in jQuery.