Showing posts with label com. Show all posts
Showing posts with label com. Show all posts

Celebrating 30 years of COM and the future of DOMAINS

| 0 comments |


(Cross-posted on the Official Google Blog.)

When you visited Google today, we’re pretty sure you didn’t type 173.194.113.18 into your browser. This string of numbers separated by periods—an IP address—isn’t nearly as easy or memorable as typing google.com. Domain names ending in things like .COM, .NET and .EDU make browsing the web and telling people where to find you online easier. Since this month marks the 30-year anniversary of .COM and several other domain endings, we’re taking a minute to celebrate these often-overlooked suffixes that have changed the way we use the web.
Though they were introduced in 1985, domain names didn’t gain much awareness and use amongst the public until the World Wide Web became available to all during the ‘90s and it became clear they were an important part in unlocking its power. Using these online addresses, people began to spread messages, start businesses and access information that otherwise would have been nearly impossible to find. Popularity and demand for these names grew so much that people were soon willing to pay millions of dollars for the perfect one.
Today there are 270+ million registered domain names; in fact, about 17 million were added just last year. To create more naming options for people online, hundreds of new top-level domains are being added, and many, like .TODAY, .NINJA and .BIKE are already available. We wrote about this back in 2012, and since then we’ve launched three of our own: .HOW, .SOY and .???.
As .COM turns 30, we’re looking back on the history of domain endings and all they’ve made possible. Today there are more choices than ever before for people to find the perfect name for their businesses, projects and ideas on the web. If you’re interested in learning more about this history, or you’d like to register your own piece of the web, head over to Google Domains to claim your .DOMAINS from a .COM to a .GURU.
Here’s to .COM’s 30th, and all that’s yet to come in how we name destinations on the Internet.

Read More..

Lookup manufacturer info by MAC address using www macvendorlookup com API

| 0 comments |
Last post show how to "Retrieve IP and MAC addresses of Android WiFi tethering clients from /proc/net/arp". This example show how to get vendor/manufacturer info of the associated MAC addresses.

(You can download runnable APK from link on bottom)


http://www.macvendorlookup.com/api provide API to lookup MAC Address Vendor/Manufacturer info.

Notice that this example havent handle error condition.


MainActivity.java
package com.blogspot.android_er.androidlistclient;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

Button btnRead;
TextView textResult;

ListView listViewNode;
ArrayList<Node> listNote;
ArrayAdapter<Node> adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnRead = (Button)findViewById(R.id.readclient);
textResult = (TextView)findViewById(R.id.result);

listViewNode = (ListView)findViewById(R.id.nodelist);
listNote = new ArrayList<>();
ArrayAdapter<Node> adapter =
new ArrayAdapter<Node>(
MainActivity.this,
android.R.layout.simple_list_item_1,
listNote);
listViewNode.setAdapter(adapter);

listViewNode.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Node node = (Node) parent.getAdapter().getItem(position);
Toast.makeText(MainActivity.this,
"MAC: " + node.mac + " " +
"IP: " + node.ip + " " +
"company: " + node.company + " " +
"country: " + node.country + " " +
"addressL1: " + node.addressL1 + " " +
"addressL2: " + node.addressL2 + " " +
"addressL3: " + node.addressL3 + " " +
"type: " + node.type + " " +
"startHex: " + node.startHex + " " +
"endHex: " + node.endHex + " " +
"startDec: " + node.startDec + " " +
"endDec: " + node.endDec,
Toast.LENGTH_SHORT).show();
}
});

btnRead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new TaskReadAddresses(listNote, listViewNode).execute();
}
});
}



class Node {
String ip;
String mac;

String jsonBody;
String startHex;
String endHex;
String startDec;
String endDec;
String company;
String addressL1;
String addressL2;
String addressL3;
String country;
String type;

String remark;

String queryString = "http://www.macvendorlookup.com/api/v2/";

Node(String ip, String mac){
this.ip = ip;
this.mac = mac;
queryMacVendorLookup();
}

@Override
public String toString() {
return "IP: " + ip + " " + "MAC: " + mac + " " + company + " " + remark;
}

private String sendQuery(String qMac) throws IOException{
String result = "";

URL searchURL = new URL(queryString + qMac);

HttpURLConnection httpURLConnection = (HttpURLConnection) searchURL.openConnection();

if(httpURLConnection.getResponseCode() == HttpURLConnection.HTTP_OK){
InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());
BufferedReader bufferedReader = new BufferedReader(
inputStreamReader,
8192);

String line = null;
while((line = bufferedReader.readLine()) != null){
result += line;
}

bufferedReader.close();
}

return result;
}


private void ParseResult(String json){

try {
JSONArray jsonArray = new JSONArray(json);
JSONObject jsonObject = (JSONObject) jsonArray.get(0);
startHex = jsonObject.getString("startHex");
endHex = jsonObject.getString("endHex");
startDec = jsonObject.getString("startDec");
endDec = jsonObject.getString("endDec");
company = jsonObject.getString("company");
addressL1 = jsonObject.getString("addressL1");
addressL2 = jsonObject.getString("addressL2");
addressL3 = jsonObject.getString("addressL3");
country = jsonObject.getString("country");
type = jsonObject.getString("type");
remark = "OK";

} catch (JSONException e) {
e.printStackTrace();
remark = e.getMessage();
}

}

private void queryMacVendorLookup(){
try {
jsonBody = sendQuery(mac);
ParseResult(jsonBody);
} catch (IOException e) {
e.printStackTrace();
}
}
}

private class TaskReadAddresses extends AsyncTask<Void, Node, Void> {

ArrayList<Node> array;
ListView listView;

TaskReadAddresses(ArrayList<Node> array, ListView v){
listView = v;
this.array = array;
array.clear();
textResult.setText("querying...");
}

@Override
protected Void doInBackground(Void... params) {
readAddresses();

return null;
}

@Override
protected void onPostExecute(Void aVoid) {
textResult.setText("Done");
}

@Override
protected void onProgressUpdate(Node... values) {
listNote.add(values[0]);
((ArrayAdapter)(listView.getAdapter())).notifyDataSetChanged();

}

private void readAddresses() {

BufferedReader bufferedReader = null;

try {
bufferedReader = new BufferedReader(new FileReader("/proc/net/arp"));

String line;
while ((line = bufferedReader.readLine()) != null) {
String[] splitted = line.split(" +");
if (splitted != null && splitted.length >= 4) {
String ip = splitted[0];
String mac = splitted[3];
if (mac.matches("..:..:..:..:..:..")) {
Node thisNode = new Node(ip, mac);
publishProgress(thisNode);
}
}
}

} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}


layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout

android_layout_width="match_parent"
android_layout_height="match_parent"
android_padding="16dp"
android_orientation="vertical"
tools_context="com.blogspot.android_er.androidlistclient.MainActivity">

<TextView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_gravity="center_horizontal"
android_autoLink="web"
android_text="http://android-er.blogspot.com/"
android_textStyle="bold" />

<Button
android_id="@+id/readclient"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_textAllCaps="false"
android_text="Read Ip/MAC addresses"/>

<TextView
android_id="@+id/result"
android_layout_width="match_parent"
android_layout_height="wrap_content"/>

<ListView
android_id="@+id/nodelist"
android_layout_width="match_parent"
android_layout_height="wrap_content"/>
</LinearLayout>


uses-permission of "android.permission.INTERNET" is needed in AndroidManifest.xml

download filesDownload runnable APK .

Next:
- Get HostName of WiFi hotspot clients, and check if it is still connected.

Read More..