Back to search

Monterey, CA; Naval Postgraduate School

A MACHINE LEARNING APPROACH FOR CLASSIFYING JAVASCRIPT USING STATIC CODE ANALYSIS

Abstract

dc:description.abstract

This thesis develops a machine learning approach to classify normal and anomalous JavaScript based on a static analysis of select features derived from the top 30 000 webpages on the internet. A dataset of 136 features was extracted from 100 000 raw JavaScript files. Nine test groups were created and tested using 10 subsets of features. K-means clustering was used to group the data and manually translate into binary classification. The results from the K-means clustering show moderate performance with distortions less than 1.0 from elbow plot analysis and average silhouette scores between 0.3 and 0.8 using silhouette analysis of the clustering. The classification of each JavaScript file was then examined using naïve Bayes algorithm to re-create and examine the performance of the highest performing classifiers using a less processing intensive method. Naïve Bayes was not a good model to re-create the K-means classifier. The best performing classifiers had a Matthews correlation coefficient of 0.75 when examining small JavaScript, and less that 0.38 when examining the medium or large JavaScript. The results show that most JavaScript files were small in file size, and file size was the only defining feature. No features tested effectively categorize the vast majority of JavaScript other than file size. Further research is needed to find features that more accurately encompass the majority of JavaScript to define normal JavaScript.

Degree

thesis:*
Name thesis:degree_name
Master of Science in Electrical Engineering
Level thesis:degree_level
Masters
Discipline thesis:degree_discipline
Electrical Engineering
Department dc:contributor.department
Electrical and Computer Engineering (ECE)
Grantor dc:publisher
Monterey, CA; Naval Postgraduate School
Year dc:date.issued
2022

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Miller, Michael D.
Advisors dc:contributor.advisor
  • McEachen, John C.
  • Tummala, Murali

Rights

dc:rights
Statement dc:rights
  • This publication is a work of the U.S. Government as defined in Title 17, United States Code, Section 101. Copyright protection is not available for this work in the United States.
  • Approved for public release. Distribution is unlimited.

Identifiers

dc:identifier.*
Dc Identifier Programcode
590, Electronic Systems Engineering
Thesis Thesis Identifier
36794

Chain of custody

source
Harvested from
Naval Postgraduate School
Base URL
calhoun.nps.edu/server/oai/request
Last updated
2026-11-19
Source record
OAI-PMH GetRecord
related terms
citation

Miller, Michael D.. A MACHINE LEARNING APPROACH FOR CLASSIFYING JAVASCRIPT USING STATIC CODE ANALYSIS. Masters thesis, Monterey, CA; Naval Postgraduate School, 2022. https://hdl.handle.net/10945/69686