A 24-year-old community college student admitted Friday that he helped hack and harass top government official as part of a collective that called itself “Crackas With Attitude.”

Justin Liverman pleaded guilty in federal court in Alexandria to one count of conspiracy to commit offenses against the United States. He faces up to five years in prison.

Quiet and thin in a wrinkled suit, he said little at the hearing. Under questioning from Judge Gerald Bruce Lee, Liverman said he had been doing well in school, earning a 3.75 grade point average.

U.S. officials familiar with the investigation say CIA ­Director John Brennan and Director of National Intelligence James R. Clapper Jr. were among the victims.

Liverman was not the mastermind behind the scheme, according to his plea agreement. A British teenager operating under the pseudonym “Cracka” did most of the actual hacking, while Liverman helped in choosing targets and harassing them.

The group’s attacks relied not on technology but so-called social engineering, according to court documents. For example, Cracka gained access to Brennan’s account by posing as a Verizon technician and tricking the company’s tech-support unit into revealing the CIA director’s account number, password and other details.

And they used the information they found not to blackmail officials or help a foreign government but for juvenile stunts.

[Men accused of hacking top government officials arrested]

It was Liverman who suggested going after the husband of White House communications director Jen Psaki, because of her negative comments about leaker Edward Snowden, a former National Security Agency contractor. He called Psaki’s cellphone and home phone multiple times.

When Cracka got into the Comcast account of former FBI deputy director Mark Giuliano, Liverman paid an online service to call him with threatening messages every hour for 30 days. He also sent Giuliano “approximately 1,000 text messages depicting a lewd image of a man,” according to the statement of facts filed Friday.

Through Giuliano, Cracka got into the Law Enforcement Enterprise Portal, which provides detailed police resources from around the country. Liverman asked for information on Miami police officers and posted a list of their names, phone numbers and email addresses online.

Liverman also encouraged Cracka to call in a fake bomb threat to the Palm Beach Sheriff’s Office in Florida.

“Hopefully they will have a shootout and kill each other,” he wrote in an online chat. “Viva la revolution.”

Other victims included Amy Hess, the FBI executive assistant director for science and technology, and Harold Rosenbaum, chief executive of CIA contractor Centra Technology.

Liverman is currently a student at Carteret Community College in North Carolina, studying computer science. He said he hopes to study at East Carolina University whenever he is released. His sentencing is set for May 12.

“It’s youthful pranks, in my opinion, that he’s owning up to,” said Tor Ekeland, one of Liverman’s lawyers.

“He’s very intelligent; it’s all about directing that intelligence,” added Marina Medvin, another of Liverman’s defense attorneys.

Another North Carolinian, 22-year-old Anthony Boggs, is set to plead guilty for his role in the group on Tuesday.