Tuesday, 30 June 2015

Shellshock Bug – How Does it Impact You?

A new security bug has been discovered recently, and it is as big, if not bigger, than the Heartbleed bug from a few months back. This security bug is called ‘Shellshock’ and it is found in a common program that runs on UNIX and Linux operating systems. The scope of this bug is pretty huge and now that attackers are aware of this, it could lead to severe security risks for many users. Not since Heartbleed have we seen such a security bug operate on such a large scale.
What is Shellshock all about?
Shellshock is a security vulnerability found in Bash. Bash is a command shell that is commonly used on Linux and UNIX operating systems and it has been around since 1989. Alarmingly, Shellshock has been around for more than 20 years now and it is yet unknown if it was accidentally developed by the creator. Just like Heartbleed, Shellshock seems to have been around for a long time and has been missed by several security audits.
What is Bash and how does Shellshock work within it?
Shellshock is what is commonly termed as a Remote Code Execution (RCE) vulnerability within Bash. Just like we have the Command Prompt on Windows, Linux and UNIX have the command shell known as Bash. It helps the user run other programs within the system and Bash stands for “Bourne Again Shell”.
Using the Shellshock vulnerability, an attacker can affect machines using a technique known as command injection. Via this method, he can run a program on Bash without intimating the user and without logging on to the computer himself. Since Bash runs several programs in the background, all the attacker needs to do is ensure that his malicious text is not spotted. Harmless looking data contains malicious code that gets executed in this scenario.
Who is vulnerable to Shellshock?
Bash is commonly used in Apple’s OS X operating system. Additionally, it is also present in several web-servers and home appliances such as routers and other devices which face the Internet. This causes further trouble as updates for these devices are not easy to acquire or implement. As a result, Shellshock could potentially disrupt several services and homes.
With Heartbleed, an attacker could only steal data stored in the memory of systems. However, with Shellshock, he can gain complete access of the system. Hence the potential risk here is far greater.
Are Microsoft Windows users also vulnerable to Shellshock?
As of now, users of Apple Macs, Linux and UNIX based machines are vulnerable to Shellshock and the Bash vulnerability. Windows users are not directly vulnerable to the same. However, attackers are working on ways to utilize this weakness against Windows users as well. So it is highly recommended that Windows users keep their OS and security software completely updated at all times.
So what is the solution for Shellshock?
There are several programs and techniques that prevent command injection. However, the problem is that no one really knows what commands to look for as attackers can mask it well. Placing a few words of malicious code within thousands of lines is very easy, and pinpointing it is like finding a needle in a haystack.
The best solution here is for Bash to be updated by the people who use it. If there are any other vendor-specific updates available, they should be initiated as well.


Monday, 29 June 2015

E-Mail Bombing

I. Description
Email bombing is characterized by abusers repeatedly sending an email message to a particular address at a specific victim site. In many instances, the messages will be large and constructed from meaningless data in an effort to consume additional system and network resources. Multiple accounts at the target site may be abused, increasing the denial of service impact.
Email spamming is a variant of bombing; it refers to sending email to hundreds or thousands of users (or to lists that expand to that many users). Email spamming can be made worse if recipients reply to the email, causing all the original addressees to receive the reply. It may also occur innocently, as a result of sending a message to mailing lists and not realizing that the list explodes to thousands of users, or as a result of a responder message (such as vacation(1)) that is setup incorrectly.
Email bombing/spamming may be combined with email spoofing (which alters the identity of the account sending the email), making it more difficult to determine who actually sent the email.

II. Technical Issues
  • If you provide email services to your user community, your users are vulnerable to email bombing and spamming.
  • Email spamming is almost impossible to prevent because a user with a valid email address can spam any other valid email address, newsgroup, or bulletin-board service.
  • When large amounts of email are directed to or through a single site, the site may suffer a denial of service through loss of network connectivity, system crashes, or failure of a service because of
    • overloading network connections
    • using all available system resources
    • filling the disk as a result of multiple postings and resulting syslog entries
III. What You Can Do
  1. Detection
  2. If your system suddenly becomes sluggish (email is slow or doesn't appear to be sent or received), the reason may be that your mailer is trying to process a large number of messages.
  3. Reaction
    1. Identify the source of the email bomb/spam and configure your router (or have your Network Service Provider configure the router) to prevent incoming packets from that address.
Review email headers to determine the true origin of the email. Review the information related to the email bomb/spam following relevant policies and procedures of your organization.
    1. Follow up with the site(s) you identified in your review to alert them to the activity. Contact them to alert them to the activity.
    2. Ensure you are up to date with the most current version of your email delivery software (sendmail, for example) and increase logging capabilities as necessary to detect or alert you to such activity.
  1. Prevention
  2. Unfortunately, at this time, there is no way to prevent email bombing or spamming (other than disconnecting from the Internet), and it is impossible to predict the origin of the next attack. It is trivial to obtain access to large mailing lists or information resources that contain large volumes of email addresses that will provide destination email addresses for the spam.
    1. Develop in-house tools to help you recognize and respond to the email bombing/spamming and so minimize the impact of such activity. The tools should increase the logging capabilities as well as check for and alert you to incoming/outgoing messages that originate from the same user or same site in a very short span of time. Once you identify the activity, you can use other in-house tools to discard the messages from the offending users or sites.
    2. If your site uses a small number of email servers, you may want to configure your firewall to ensure that SMTP connections from outside your firewall can be made only to your central email hubs and to none of your other systems. Although this will not prevent an attack, it minimizes the number of machines available to an intruder for an SMTP-based attack (whether that attack is a email spam or an attempt to break into a host). It also means that should you wish to control incoming SMTP in a particular way (through filtering or another means), you have only a small number of systems--the main email hub and any backup email hubs--to configure.
    3. Consider configuring your mail handling system(s) to deliver email into filesystems that have per-user quotas enabled. Doing this can minimize the impact of an email bombing attack by limiting the damage to only the targeted accounts and not the entire system.
    4. Educate your users to call you about email bombing and spamming.
    5. Do not propagate the problem by forwarding (or replying to) spammed email.
There are three methods of perpetrating an email bomb; Mass mailing, list linking and zip bombing

Mass mailing

Mass mailing consists of sending numerous duplicate mails to the same email address. These types of mail bombs are simple to design but their extreme simplicity means they can be easily detected by spam filters. Email-bombing using mass mailing is also commonly performed as a DDoS attack by employing the use of "zombie" botnets; hierarchical networks of computers compromised by malware and under the attacker's control. Similar to their use in spamming, the attacker instructs the botnet to send out millions or even billions of emails, but unlike normal botnet spamming, the emails are all addressed to only one or a few addresses the attacker wishes to flood. This form of email bombing is similar in purpose to other DDoS flooding attacks. As the targets are frequently the dedicated hosts handling website and email accounts of a business, this type of attack can be just as devastating to both services of the host.
This type of attack is more difficult to defend against than a simple mass-mailing bomb because of the multiple source addresses and the possibility of each zombie computer sending a different message or employing stealth techniques to defeat spam filters.

List linking

List linking means signing a particular email address up to several email list subscriptions. The victim then has to unsubscribe from these unwanted services manually. In order to prevent this type of bombing, most email subscription services send a confirmation email to a person's inbox when that email is used to register for a subscription. This method of prevention is easily circumvented: if the perpetrator registers a new email account and sets it to automatically forward all mail to the victim, he or she can reply to the confirmation emails, and the list linking can proceed.

Zip bombing

A ZIP bomb is a variant of mail-bombing. After most commercial mail servers began checking mail with anti-virus software and filtering certain malicious file types, EXE, RAR, Zip,7-Zip, mail server software was then configured to unpack archives and check their contents as well. A new idea to combat this solution was composing a "bomb" consisting of an enormous text file, containing, for example, only the letter z repeating millions of times. Such a file compresses into a relatively small archive, but its unpacking (especially by early versions of mail servers) would use a greater amount of processing, which could result in a DoS (Denial of Service).

Saturday, 27 June 2015

How Do You Fix Computer Errors?

Computers are awesome machines that were invented many years ago. Dramatic changes in our daily lives have taken place as a result of the computer. There are only a few things we should do to prevent or eliminate computer errors.
When To Eliminate Computer Errors
Invalid, corrupt, and infected registry entries occur in the DLL, EXE, and Driver files causing the registry to act sporadic. When the registry is unstable it will slow down the computer with poor performance. That is the time to fix computer errors.
Things We Can Do To Remove Computer Errors
• Run Disk Defragmenter
This compresses all the files together and reduces errors.
REGISTRY CLEANER

Running daily scans on your computer through the use of a registry cleaner will eliminate registry data that should be removed. Regular automatic registry maintenance tasks need to be done to help prevent infections. A good registry cleaner detects all computer problems that shouldn't be there, eliminates them and fixes the registry - bringing it back to peak performance.
Viruses Affect The Performance
Malware, adware, and spyware are guilty of many of the errors that show up in the registry. This makes it difficult for the computer's performance. Spyware steals confidential private data sending it on to third parties. This is used for many different objectives including reselling the information, trying to sell you similar products, or passing private information on for malicious use. Using a good registry cleaner to clean the registry and spyware software to remove adware, spyware and other virus from the registry will keep your computer running in top form.

WINDOWS XP Boot CD
If your system no longer will boot up, it has severely been compromised by corrupt programs and virus infections. Installing the Windows XP Boot CD can sometimes be helpful when experiencing failure of the system booting up properly. This repairs the Windows XP installation files.
If your systems memory resources are low, this can have several affects on the computer. This can lead to system crashes, system freezing, blue screen and errors popping up on the screen. It's possible you need to boost your systems RAM (memory). This will greatly boost the computers performance. If you do this, consider 5-6 Gig. of memory minimum. If you can afford 8-10 Gig., would be even better.
Most of the advice mentioned above should keep your PC running at peak performance. If, however, you still have some problems not related to the above advice - like maybe hardware issues or devises - you can check those in the system settings. It is possible your devise drivers need to be updated. The Mother Board could be worn out and needs replacing. Usually, if you follow the advice above, it will solve your computer issues. You also can check on the internet for any additional problems relating to your computer, but make sure those are trusted sites. Windows Fix and Repair is another option.
A Word to the Wise
Always have a full backup of your computer and programs!

Your Business Needs Antivirus

Have you long been wondering whether your network is safe or not? Well, the fact of the matter is that with the passage of time, hackers have also taken on sophisticated approaches. This deems it all the more necessary for you to make use of antivirus software to keep your business computers protected against external harm. With the recent viruses such as Cryptolocker and Cryptowall costing businesses millions of dollars the need for business security has never been more important and should be at the forefront of business owner's thoughts.
There are many different forms that viruses tend to take. There are those that work by infiltrating your computer so as to disrupt its operating systems. Although these viruses are more so harmless, the disruption that they cause by corrupting files has the tendency to lead to substantial down-time. This results in reduction in productivity, leading to major loss in terms of time and money.
There remains the fact that online crimes, particularly identity theft is on the rise. For this reason, hackers are prone to the utilization of spyware to acquire as much information about you as possible. This is basically an attempt to acquire your passwords, along with your financial and personal information. For a business, such a breach of security can turn out to be a major issue in the long run. This additionally has the potential to have sensitive business information leaked out. This is inclusive of trade secrets, customer listings and even pricing. This sensitive information can then be used for malicious intents, thereby bringing disrepute to your business - something that you simply cannot afford.
Which antivirus should I use?
There are countless anti-virus software currently available. However, not all of them offer the sort of security, and anti-spam features that businesses should acquire. So, which antivirus for business should you use? Well, amongst the myriads of antivirus available these days, the best is AVG for business. When you go through the latest antivirus reviews, you are bound to learn about the endless benefits that AVG has to offer for your business - adequate security, ample spam prevention, and extravagant hacking protection - AVG offers it all.
However, the one thing that you need to bear in mind is that the mere installation of antivirus software onto your business computer isn't going to deliver any benefits as such. For this reason, it is extremely important for you to make sure that the antivirus software is updated on a regular basis, and that it is used for virus detection purposes every now and then. Generally speaking, it is best for you to formulate a regular schedule for this purpose. This way, your business computers are going too protected against any and all new threats that they are susceptible to.
The impact of cloud computing for business on security
Things have changed rather significantly in the business world with the introduction of cloud computing. Now, securing physical devices is not as important as security browsing activities, virtual identities and personal data. While we are at it, there are also handheld devices, because of which, securing online interactions is a whole lot more important these days.
As a business, you entrust highly confidential data to the cloud via your chosen business cloud service, so you don't really need to be worried about direct threats to devices. You basically need to be focused on preventing your personal data or identities from being compromised upon. This is because any weakness in your business security system is going to make you vulnerable to hackers. So, while you keep your devices protected by a top quality antivirus for business, make sure that you also keep your online interactions safe. If you require more information or are looking to setup antivirus software for your business contact your local IT services company or local tech support guy.
Contact your local IT support company to learn how you can benefit from local IT services and antivirus.

Friday, 26 June 2015

Now Read Barcodes Online

Barcodes are everywhere today. They are particularly popular with retail stores, for warehouse inventory applications, and more. Essentially, barcodes are important for applications where easily sharing information via computers or mobile devices is important.
As the hunger for more online information sharing and saving grows so too does the need to process barcode information from a web application. But how can you integrate barcode reading technology with web technologies?
If you have tried integrating a barcode with a web application before, you will know how time-consuming the task can be. However, with the help of Dynamsoft's Dynamic Web TWAIN 10.2 Barcode Reader Add-on, you can make it happen in just a few minutes.
In this tutorial, I will show you step by step how to build a simple barcode reading web application.
For this tutorial, you need a basic understanding of HTML and JavaScript. There is no CSS involved in this demo page. We'll concentrate on the barcode functionality in this tutorial. You can add whatever styles you like afterward. Even if you are a novice to web programming, you will find this tutorial easy to follow. So just take it easy and have some fun.
Here is a summary of the steps:
1. Start a Web Application
2. Add Dynamic Web TWAIN to the HTML Page
3. Scan or Load Images
4. Read Barcodes
In step 1, 2, and 3, we are integrating Dynamic Web TWAIN with your web application. This is a prerequisite for barcode processing as, in this case, Barcode Reader is an add-on of Dynamic Web TWAIN.
Step 1: Start a Web Application
You can get Dynamic Web TWAIN Barcode Reader Resources files either from Dynamsoft's Dynamic Web TWAIN 9.2 free 30-day trial or the barcode sample code we used in this tutorial.
Create an empty HTML page named readbarcode.HTML. Put it on the same folder as the Resources folder.
Step 2: Add Dynamic Web TWAIN to the HTML Page
Include dynamsoft.webtwain.initiate.js, dynamsoft.webtwain.config.js, and dynamsoft.webtwain.addon.barcode.js in the HTML head. dynamsoft.webtwain.initiate.js and dynamsoft.webtwain.config.js are responsible for Dynamic Web TWAIN's initialization, while dynamsoft.webtwain.addon.barcode.js provides all barcode related API interfaces:
<script type="text/javascript" src="Resources/dynamsoft.webtwain.initiate.js"> </script>
<script type="text/javascript" src="Resources/dynamsoft.webtwain.config.js"> </script>
<script type="text/javascript" src="Resources/addon/dynamsoft.webtwain.addon.barcode.js"> </script>
Add a div container, and register the OnWebTwainReady event to get access to Dynamic Web TWAIN via DWObject:
<div id="dwtcontrolContainer"></div>
<script type="text/javascript">
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
var DWObject;
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
}
Step 3: Scan or Load Images
Add Scan and Load buttons to the page:
<input type="button" value="Scan" onclick="AcquireImage();" />
<input type="button" value="Load" onclick="LoadImage();" /><br />
And add the implementation of function AcquireImage() and LoadImage(). Notice how LoadImage() handles success and failure with callback functions OnSuccess() and OnFailure():
function AcquireImage() {
if (DWObject) {
DWObject.SelectSource();
DWObject.OpenSource();
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
DWObject.AcquireImage();
}
}
//Callback functions for async APIs
function OnSuccess() {
console.log('successful');
}
function OnFailure(errorCode, errorString) {
alert(errorString);
}
function LoadImage() {
if (DWObject) {
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
DWObject.LoadImageEx("", EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp,.jpg,.tif,.png,.pdf). OnSuccess or OnFailure will be called after the operation
}
}
Step 4: Read Barcodes
Now you have two options to get the image loaded:
Scan images from a scanner (AcquireImage());
Or load hard disk images (LoadImage()).
It's time to add the Dynamic Web TWAIN Barcode Reader add-on to your web page.
Add a selection list for supported barcode formats:
<select id="barcodeformat"></select>
And populate it in function Dynamsoft_OnReady():
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
if (DWObject) {//Currently only code 39 and code 128 are supported
document.getElementById("barcodeformat").options.add(new Option("Code 39", 1));
document.getElementById("barcodeformat").options.add(new Option("Code 128", 0));
}
}
Dynamic Web TWAIN 10.2 Barcode Reader Add-on supports Code 39 and Code 128 barcodes. Another independent barcode product from Dynamsoft, called Dynamsoft Barcode Reader, supports more barcode types. They include Code 39, Code 93, Code 128, Codabar, ITF, EAN-13, EAN-8, UPC-A, UPC-E, etc. The next version of Dynamic Web TWAIN Barcode Reader Add-on will support all these barcode types as well.
Now it comes to the most important part of this tutorial - barcode reading logic. Please notice that how callback functions are used to deal with the success and failure scenarios for barcode reading:
function GetBarcodeInfo(sImageIndex, result) {
//Retrieve barcode details
var count = result.GetCount();
if (count == 0) {
alert("The barcode for the selected format is not found.");
return;
} else {
for (I = 0; I < count; I++) {
var text = result.GetContent(I);
var x = result.GetX1(I);
var y = result.GetY1(I);
var format = result.GetFormat(I);
var barcodeText = ("barcode[" + (I + 1) + "]: " + text + "\n");
barcodeText += ("format:" + format + "\n");
barcodeText += ("x: " + x + " y:" + y + "\n");
alert(barcodeText);
}
}
}
//This is the function called when barcode reading fails
function GetErrorInfo (errorcode, errorstring) {
alert(errorstring);
}
function ReadBarcode() {
var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
if (DWObject) {
if (DWObject.HowManyImagesInBuffer == 0) {
alert("Please scan or load an image first.");
return;
}
//Get barcode result.
switch (document.getElementById("barcodeformat").selectedIndex) {
case 0:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_39, GetBarcodeInfo, GetErrorInfo);
break;
case 1:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_128, GetBarcodeInfo, GetErrorInfo);
break;
default:
break;
}
}
} Barcodes are everywhere today. They are particularly popular with retail stores, for warehouse inventory applications, and more. Essentially, barcodes are important for applications where easily sharing information via computers or mobile devices is important.
As the hunger for more online information sharing and saving grows so too does the need to process barcode information from a web application. But how can you integrate barcode reading technology with web technologies?
If you have tried integrating a barcode with a web application before, you will know how time-consuming the task can be. However, with the help of Dynamsoft's Dynamic Web TWAIN 10.2 Barcode Reader Add-on, you can make it happen in just a few minutes.
In this tutorial, I will show you step by step how to build a simple barcode reading web application.
For this tutorial, you need a basic understanding of HTML and JavaScript. There is no CSS involved in this demo page. We'll concentrate on the barcode functionality in this tutorial. You can add whatever styles you like afterward. Even if you are a novice to web programming, you will find this tutorial easy to follow. So just take it easy and have some fun.
Here is a summary of the steps:
1. Start a Web Application
2. Add Dynamic Web TWAIN to the HTML Page
3. Scan or Load Images
4. Read Barcodes
In step 1, 2, and 3, we are integrating Dynamic Web TWAIN with your web application. This is a prerequisite for barcode processing as, in this case, Barcode Reader is an add-on of Dynamic Web TWAIN.
Step 1: Start a Web Application
You can get Dynamic Web TWAIN Barcode Reader Resources files either from Dynamsoft's Dynamic Web TWAIN 9.2 free 30-day trial or the barcode sample code we used in this tutorial.
Create an empty HTML page named readbarcode.HTML. Put it on the same folder as the Resources folder.
Step 2: Add Dynamic Web TWAIN to the HTML Page
Include dynamsoft.webtwain.initiate.js, dynamsoft.webtwain.config.js, and dynamsoft.webtwain.addon.barcode.js in the HTML head. dynamsoft.webtwain.initiate.js and dynamsoft.webtwain.config.js are responsible for Dynamic Web TWAIN's initialization, while dynamsoft.webtwain.addon.barcode.js provides all barcode related API interfaces:
<script type="text/javascript" src="Resources/dynamsoft.webtwain.initiate.js"> </script>
<script type="text/javascript" src="Resources/dynamsoft.webtwain.config.js"> </script>
<script type="text/javascript" src="Resources/addon/dynamsoft.webtwain.addon.barcode.js"> </script>
Add a div container, and register the OnWebTwainReady event to get access to Dynamic Web TWAIN via DWObject:
<div id="dwtcontrolContainer"></div>
<script type="text/javascript">
Dynamsoft.WebTwainEnv.RegisterEvent('OnWebTwainReady', Dynamsoft_OnReady); // Register OnWebTwainReady event. This event fires as soon as Dynamic Web TWAIN is initialized and ready to be used
var DWObject;
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer'
}
Step 3: Scan or Load Images
Add Scan and Load buttons to the page:
<input type="button" value="Scan" onclick="AcquireImage();" />
<input type="button" value="Load" onclick="LoadImage();" /><br />
And add the implementation of function AcquireImage() and LoadImage(). Notice how LoadImage() handles success and failure with callback functions OnSuccess() and OnFailure():
function AcquireImage() {
if (DWObject) {
DWObject.SelectSource();
DWObject.OpenSource();
DWObject.IfDisableSourceAfterAcquire = true; // Scanner source will be disabled/closed automatically after the scan.
DWObject.AcquireImage();
}
}
//Callback functions for async APIs
function OnSuccess() {
console.log('successful');
}
function OnFailure(errorCode, errorString) {
alert(errorString);
}
function LoadImage() {
if (DWObject) {
DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
DWObject.LoadImageEx("", EnumDWT_ImageType.IT_ALL, OnSuccess, OnFailure); // Load images in all supported formats (.bmp,.jpg,.tif,.png,.pdf). OnSuccess or OnFailure will be called after the operation
}
}
Step 4: Read Barcodes
Now you have two options to get the image loaded:
Scan images from a scanner (AcquireImage());
Or load hard disk images (LoadImage()).
It's time to add the Dynamic Web TWAIN Barcode Reader add-on to your web page.
Add a selection list for supported barcode formats:
<select id="barcodeformat"></select>
And populate it in function Dynamsoft_OnReady():
function Dynamsoft_OnReady() {
DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
if (DWObject) {//Currently only code 39 and code 128 are supported
document.getElementById("barcodeformat").options.add(new Option("Code 39", 1));
document.getElementById("barcodeformat").options.add(new Option("Code 128", 0));
}
}
Dynamic Web TWAIN 10.2 Barcode Reader Add-on supports Code 39 and Code 128 barcodes. Another independent barcode product from Dynamsoft, called Dynamsoft Barcode Reader, supports more barcode types. They include Code 39, Code 93, Code 128, Codabar, ITF, EAN-13, EAN-8, UPC-A, UPC-E, etc. The next version of Dynamic Web TWAIN Barcode Reader Add-on will support all these barcode types as well.
Now it comes to the most important part of this tutorial - barcode reading logic. Please notice that how callback functions are used to deal with the success and failure scenarios for barcode reading:
function GetBarcodeInfo(sImageIndex, result) {
//Retrieve barcode details
var count = result.GetCount();
if (count == 0) {
alert("The barcode for the selected format is not found.");
return;
} else {
for (I = 0; I < count; I++) {
var text = result.GetContent(I);
var x = result.GetX1(I);
var y = result.GetY1(I);
var format = result.GetFormat(I);
var barcodeText = ("barcode[" + (I + 1) + "]: " + text + "\n");
barcodeText += ("format:" + format + "\n");
barcodeText += ("x: " + x + " y:" + y + "\n");
alert(barcodeText);
}
}
}
//This is the function called when barcode reading fails
function GetErrorInfo (errorcode, errorstring) {
alert(errorstring);
}
function ReadBarcode() {
var DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
if (DWObject) {
if (DWObject.HowManyImagesInBuffer == 0) {
alert("Please scan or load an image first.");
return;
}
//Get barcode result.
switch (document.getElementById("barcodeformat").selectedIndex) {
case 0:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_39, GetBarcodeInfo, GetErrorInfo);
break;
case 1:
result = DWObject.Addon.Barcode.Read(
DWObject.CurrentImageIndexInBuffer, EnumDWT_BarcodeFormat.CODE_128, GetBarcodeInfo, GetErrorInfo);
break;
default:
break;
}
}
}
Now, save the file.
Okay, we are all set. You can open readbarcode.HTML in a browser and start barcode reading.
Conclusion


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

Now, save the file.
Okay, we are all set. You can open readbarcode.HTML in a browser and start barcode reading.